Allow openExternal to open URLs in the background #3224

This commit is contained in:
Ben Gotow 2016-02-02 23:01:00 -08:00 committed by Kevin Sawicki
parent 57f322a818
commit d8679b3899
7 changed files with 33 additions and 9 deletions

View file

@ -119,7 +119,7 @@ void OpenItem(const base::FilePath& full_path) {
}
}
bool OpenExternal(const GURL& url) {
bool OpenExternal(const GURL& url, const bool without_activation) {
DCHECK([NSThread isMainThread]);
NSURL* ns_url = net::NSURLWithGURL(url);
if (!ns_url) {
@ -136,7 +136,15 @@ bool OpenExternal(const GURL& url) {
}
CFRelease(openingApp); // NOT A BUG; LSGetApplicationForURL retains for us
return [[NSWorkspace sharedWorkspace] openURL:ns_url];
NSUInteger launchOptions = NSWorkspaceLaunchDefault;
if (without_activation)
launchOptions = launchOptions | NSWorkspaceLaunchWithoutActivation;
return [[NSWorkspace sharedWorkspace] openURLs: @[ns_url]
withAppBundleIdentifier: nil
options: launchOptions
additionalEventParamDescriptor: NULL
launchIdentifiers: NULL];
}
bool MoveItemToTrash(const base::FilePath& full_path) {