diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-13 14:58:54 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-13 14:58:54 +0000 |
commit | ff81e0ab0176b25ba98d35ab46a3a5b256b170d1 (patch) | |
tree | fc607f851f438315d3cd753b4b1bd00a970ff1a3 /chrome/browser/app_controller_mac.mm | |
parent | 56a4355f80e324bd8f7aa439fb6424f86475c94d (diff) | |
download | chromium_src-ff81e0ab0176b25ba98d35ab46a3a5b256b170d1.zip chromium_src-ff81e0ab0176b25ba98d35ab46a3a5b256b170d1.tar.gz chromium_src-ff81e0ab0176b25ba98d35ab46a3a5b256b170d1.tar.bz2 |
Adds the ability to open a new window by clicking on the dock icon,
if there are no currently open windows. If there are minimized windows
but no open windows, the most recently minimized window will open. Patch from rohitrao@google.com
BUG=9548
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13592 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/app_controller_mac.mm')
-rw-r--r-- | chrome/browser/app_controller_mac.mm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index c042dd8..71eb508 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -103,6 +103,24 @@ }; } +// NSApplication delegate method called when someone clicks on the +// dock icon and there are no open windows. To match standard mac +// behavior, we should open a new window. +- (BOOL)applicationShouldHandleReopen:(NSApplication*)theApplication + hasVisibleWindows:(BOOL)flag { + // Don't do anything if there are visible windows. This will cause + // AppKit to unminimize the most recently minimized window. + if (flag) + return YES; + + // Otherwise open a new window. + Browser::OpenEmptyWindow([self defaultProfile]); + + // We've handled the reopen event, so return NO to tell AppKit not + // to do anything. + return NO; +} + - (void)initMenuState { menuState_ = new CommandUpdater(NULL); menuState_->UpdateCommandEnabled(IDC_NEW_WINDOW, true); |