diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 00:33:38 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 00:33:38 +0000 |
commit | f4acfae80866fff2e2fc760c396ba89db57de522 (patch) | |
tree | ccdd618b0d16fb94e8c10d11218b689df8cd9083 /chrome/browser/app_controller_mac.mm | |
parent | 33521502aee91e668255810164fd122b7b47bd89 (diff) | |
download | chromium_src-f4acfae80866fff2e2fc760c396ba89db57de522.zip chromium_src-f4acfae80866fff2e2fc760c396ba89db57de522.tar.gz chromium_src-f4acfae80866fff2e2fc760c396ba89db57de522.tar.bz2 |
Add command line switch --activate-on-launch to help Selenium.
Implemented for Mac; behavior implicit on Windows.
If you do NOT get an "activate on launch" behavior on Windows, it is
because Selenium is not the current foreground app. See
http://msdn.microsoft.com/en-us/library/ms633539(VS.85).aspx
for details on foreground behavior. This isn't something we can fix
in Chrome on Windows.
BUG=http://crbug.com/20935
TEST=Launch Chrome from the command line.
E.g. "..../Chromium.app/Contents/MacOS/Chromium". See it NOT gain
foreground. Add --activate-on-launch. DO see it gain foreground.
Review URL: http://codereview.chromium.org/202053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25958 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/app_controller_mac.mm')
-rw-r--r-- | chrome/browser/app_controller_mac.mm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index be11db3..e3f88e9 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -30,6 +30,7 @@ #include "chrome/browser/download/download_manager.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/sessions/tab_restore_service.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/browser/profile_manager.h" @@ -108,6 +109,17 @@ // Set up the command updater for when there are no windows open [self initMenuState]; + + // Activate (bring to foreground) if asked to do so. On + // Windows this logic isn't necessary since + // BrowserWindow::Activate() calls ::SetForegroundWindow() which is + // adequate. On Mac, BrowserWindow::Activate() calls -[NSWindow + // makeKeyAndOrderFront:] which does not activate the application + // itself. + const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); + if (parsed_command_line.HasSwitch(switches::kActivateOnLaunch)) { + [NSApp activateIgnoringOtherApps:YES]; + } } // Checks if there are any tabs with sheets open, and if so, raises one of |