diff options
author | jackhou@chromium.org <jackhou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-24 11:05:33 +0000 |
---|---|---|
committer | jackhou@chromium.org <jackhou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-24 11:05:33 +0000 |
commit | 2fd243794b1049ea40f94d839f16d35ff403879b (patch) | |
tree | 2ca3e2f614082adf92d495c8cbaed1ba34d6b6bf /base/mac | |
parent | 0a62104c0b55ea0402b154358e3ffbdcfbadf093 (diff) | |
download | chromium_src-2fd243794b1049ea40f94d839f16d35ff403879b.zip chromium_src-2fd243794b1049ea40f94d839f16d35ff403879b.tar.gz chromium_src-2fd243794b1049ea40f94d839f16d35ff403879b.tar.bz2 |
Fix app shim focus.
When launching an app from Chrome, start the app shim without activating
it.
In case the app was launched from the shim, focus the app when its first
window opens.
BUG=263217
TEST=Start an app from the NTP.
The shim should start without stealing focus.
Quit and restart the app from the shim.
The app's first window should take focus.
Close the window and click the app's dock icon.
A new window should open and take focus.
Review URL: https://chromiumcodereview.appspot.com/20037002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac')
-rw-r--r-- | base/mac/launch_services_util.cc | 5 | ||||
-rw-r--r-- | base/mac/launch_services_util.h | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/base/mac/launch_services_util.cc b/base/mac/launch_services_util.cc index 0081500..6121081 100644 --- a/base/mac/launch_services_util.cc +++ b/base/mac/launch_services_util.cc @@ -4,8 +4,6 @@ #include "base/mac/launch_services_util.h" -#include <ApplicationServices/ApplicationServices.h> - #include "base/logging.h" #include "base/mac/mac_logging.h" #include "base/mac/mac_util.h" @@ -16,6 +14,7 @@ namespace mac { bool OpenApplicationWithPath(const base::FilePath& bundle_path, const CommandLine& command_line, + LSLaunchFlags launch_flags, ProcessSerialNumber* out_psn) { FSRef app_fsref; if (!base::mac::FSRefFromPath(bundle_path.value(), &app_fsref)) { @@ -45,7 +44,7 @@ bool OpenApplicationWithPath(const base::FilePath& bundle_path, LSApplicationParameters ls_parameters = { 0, // version - kLSLaunchDefaults, + launch_flags, &app_fsref, NULL, // asyncLaunchRefCon NULL, // environment diff --git a/base/mac/launch_services_util.h b/base/mac/launch_services_util.h index cd17950..d4aa9ff 100644 --- a/base/mac/launch_services_util.h +++ b/base/mac/launch_services_util.h @@ -5,6 +5,8 @@ #ifndef BASE_MAC_LAUNCH_SERVICES_UTIL_H_ #define BASE_MAC_LAUNCH_SERVICES_UTIL_H_ +#include <ApplicationServices/ApplicationServices.h> + #include "base/base_export.h" #include "base/command_line.h" #include "base/files/file_path.h" @@ -16,11 +18,13 @@ namespace mac { // Launches the application bundle at |bundle_path|, passing argv[1..] from // |command_line| as command line arguments if the app isn't already running. +// |launch_flags| are passed directly to LSApplicationParameters. // |out_psn|, if not NULL, will be set to the process serial number of the // application's main process if the app was successfully launched. // Returns true if the app was successfully launched. BASE_EXPORT bool OpenApplicationWithPath(const base::FilePath& bundle_path, const CommandLine& command_line, + LSLaunchFlags launch_flags, ProcessSerialNumber* out_psn); } // namespace mac |