diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-27 13:04:00 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-27 13:04:00 +0000 |
commit | 449dd2fa0f79ea68566f04399b3860b59762bc62 (patch) | |
tree | f701362fb866e7dbd065db7a4b9d8881d24fb9c1 /chrome/browser/cocoa/tab_strip_controller.mm | |
parent | b004209b94e258e9ca5a2356e4bd108f8443e142 (diff) | |
download | chromium_src-449dd2fa0f79ea68566f04399b3860b59762bc62.zip chromium_src-449dd2fa0f79ea68566f04399b3860b59762bc62.tar.gz chromium_src-449dd2fa0f79ea68566f04399b3860b59762bc62.tar.bz2 |
Fix issue where cmd-w was hard-coded to closing a browser tab regardless of the frontmost window type. Have cmd-key equiv correctly set depending on the window type and the number of tabs in the window. Broadcast notification when the number of tabs changes in the model. Disable "close tab" item when there's only 1 tab in the browser window.
BUG=10047
TEST=cmd-w correctly closes the expected thing (frontmost window, or tab in the frontmost window). close tab should be disabled when the frontmost tab is not a browser or if there is only 1 tab in the window.
Review URL: http://codereview.chromium.org/115789
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16981 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_strip_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.mm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm index 6fed79f..b81b455 100644 --- a/chrome/browser/cocoa/tab_strip_controller.mm +++ b/chrome/browser/cocoa/tab_strip_controller.mm @@ -22,6 +22,8 @@ #include "chrome/browser/tabs/tab_strip_model.h" #include "grit/generated_resources.h" +NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged"; + // A simple view class that prevents the windowserver from dragging the // area behind tabs. Sometimes core animation confuses it. @interface TabStripControllerDragBlockingView : NSView @@ -337,6 +339,11 @@ if (!inForeground) { [self layoutTabs]; } + + // Send a broadcast that the number of tabs have changed. + [[NSNotificationCenter defaultCenter] + postNotificationName:kTabStripNumberOfTabsChanged + object:self]; } // Called when a notification is received from the model to select a particular @@ -397,6 +404,11 @@ // Once we're totally done with the tab, delete its controller [tabArray_ removeObjectAtIndex:index]; + // Send a broadcast that the number of tabs have changed. + [[NSNotificationCenter defaultCenter] + postNotificationName:kTabStripNumberOfTabsChanged + object:self]; + [self layoutTabs]; } |