Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 8302021: Prevent extension and bookmark popups from interfering with close window/tab shortcuts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check for child windows Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/browser_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 45a5e51f3843fd88ceae33acc820269830b9b068..796d9cc969b23052f7ec04247e0c690553e313cc 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -985,7 +985,7 @@ enum {
// although we could cheat and directly ask the app controller if our
// command_updater doesn't support the command. This may or may not be an issue,
// too early to tell.
-- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
+- (BOOL)validateUserInterfaceItem:(NSMenuItem*)item {
Scott Hess - ex-Googler 2011/10/25 23:40:59 I'm not sure this is only NSMenuItem*. If it defi
Ilya Sherman 2011/10/26 23:22:40 Oh, I missed those below. It seems weird that thi
SEL action = [item action];
BOOL enable = NO;
if (action == @selector(commandDispatch:) ||
@@ -996,9 +996,11 @@ enum {
enable = browser_->command_updater()->IsCommandEnabled(tag);
switch (tag) {
case IDC_CLOSE_TAB:
- // Disable "close tab" if we're not the key window or if there's only
- // one tab.
- enable &= [[self window] isKeyWindow];
+ // Disable "close tab" if the receiving window is not tabbed.
+ // We simply check whether the item has a keyboard shortcut set here;
+ // app_controller_mac.mm actually determines whether the item should
+ // be enabled.
+ enable &= !![[item keyEquivalent] length];
break;
case IDC_FULLSCREEN: {
enable &= [self supportsFullscreen];
« chrome/browser/app_controller_mac.mm ('K') | « chrome/browser/app_controller_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698