Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallback URL to handoff #5658

Merged
merged 1 commit into from May 25, 2016

Conversation

Projects
None yet
4 participants
@danhp
Copy link
Member

commented May 23, 2016

Closes #5566

void Browser::SetUserActivity(const std::string& type,
const base::DictionaryValue& user_info,
mate::Arguments* args) {
std::string URL = "";

This comment has been minimized.

Copy link
@zcbenz

zcbenz May 24, 2016

Member

Passing string directly may have escaping problems, the safe way is to use net::NSURLWithGURL to convert the url to NSURL.

[[AtomApplication sharedApplication]
setCurrentActivity:base::SysUTF8ToNSString(type)
withUserInfo:DictionaryValueToNSDictionary(user_info)];
withUserInfo:DictionaryValueToNSDictionary(user_info)
withWebpageURL:[NSURL URLWithString:base::SysUTF8ToNSString(URL)]];

This comment has been minimized.

Copy link
@zcbenz

zcbenz May 24, 2016

Member

We can probably pass nil here if the url is not specified.

@anaisbetts

This comment has been minimized.

Copy link
Contributor

commented May 24, 2016

/cc @CharlieHess who has Interests

[[AtomApplication sharedApplication]
setCurrentActivity:base::SysUTF8ToNSString(type)
withUserInfo:DictionaryValueToNSDictionary(user_info)];
withUserInfo:DictionaryValueToNSDictionary(user_info)
withWebpageURL:net::NSURLWithGURL(GURL(url_string))];

This comment has been minimized.

Copy link
@danhp

danhp May 24, 2016

Author Member

NSURL is now nil if url is invalid (i.e. not specified).
See NSURLWithGURL

currentActivity_ = base::scoped_nsobject<NSUserActivity>(
[[NSUserActivity alloc] initWithActivityType:type]);
[currentActivity_ setUserInfo:userInfo];

// Only set the webpageURL if it is valid
if (webpageURL && [webpageURL scheme] && [webpageURL host])

This comment has been minimized.

Copy link
@zcbenz

zcbenz May 25, 2016

Member

We probably don't need the check anymore, webpageURL is guaranteed to be either nil or a valid URL, and both are safe to be passed to setWebpageURL.

@danhp

This comment has been minimized.

Copy link
Member Author

commented May 25, 2016

Done 😄

@zcbenz

This comment has been minimized.

Copy link
Member

commented May 25, 2016

👍

@zcbenz zcbenz merged commit f34cd87 into electron:master May 25, 2016

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@danhp danhp deleted the danhp:handoff-fallback branch May 25, 2016

@dasilvacontin

This comment has been minimized.

Copy link

commented May 25, 2016

Looking forward to playing with this – thanks! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.