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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <numeric> 8 #include <numeric>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { 988 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
989 SEL action = [item action]; 989 SEL action = [item action];
990 BOOL enable = NO; 990 BOOL enable = NO;
991 if (action == @selector(commandDispatch:) || 991 if (action == @selector(commandDispatch:) ||
992 action == @selector(commandDispatchUsingKeyModifiers:)) { 992 action == @selector(commandDispatchUsingKeyModifiers:)) {
993 NSInteger tag = [item tag]; 993 NSInteger tag = [item tag];
994 if (browser_->command_updater()->SupportsCommand(tag)) { 994 if (browser_->command_updater()->SupportsCommand(tag)) {
995 // Generate return value (enabled state) 995 // Generate return value (enabled state)
996 enable = browser_->command_updater()->IsCommandEnabled(tag); 996 enable = browser_->command_updater()->IsCommandEnabled(tag);
997 switch (tag) { 997 switch (tag) {
998 case IDC_CLOSE_TAB:
999 // Disable "close tab" if we're not the key window or if there's only
1000 // one tab.
1001 enable &= [[self window] isKeyWindow];
1002 break;
Ilya Sherman 2011/10/15 04:31:38 I think this code is obsolete. It definitely only
1003 case IDC_FULLSCREEN: { 998 case IDC_FULLSCREEN: {
1004 enable &= [self supportsFullscreen]; 999 enable &= [self supportsFullscreen];
1005 if ([static_cast<NSObject*>(item) isKindOfClass:[NSMenuItem class]]) { 1000 if ([static_cast<NSObject*>(item) isKindOfClass:[NSMenuItem class]]) {
1006 NSString* menuTitle = l10n_util::GetNSString( 1001 NSString* menuTitle = l10n_util::GetNSString(
1007 [self isFullscreen] ? IDS_EXIT_FULLSCREEN_MAC : 1002 [self isFullscreen] ? IDS_EXIT_FULLSCREEN_MAC :
1008 IDS_ENTER_FULLSCREEN_MAC); 1003 IDS_ENTER_FULLSCREEN_MAC);
1009 [static_cast<NSMenuItem*>(item) setTitle:menuTitle]; 1004 [static_cast<NSMenuItem*>(item) setTitle:menuTitle];
1010 1005
1011 if (base::mac::IsOSSnowLeopardOrEarlier()) 1006 if (base::mac::IsOSSnowLeopardOrEarlier())
1012 [static_cast<NSMenuItem*>(item) setHidden:YES]; 1007 [static_cast<NSMenuItem*>(item) setHidden:YES];
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 2138
2144 - (BOOL)supportsBookmarkBar { 2139 - (BOOL)supportsBookmarkBar {
2145 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2140 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2146 } 2141 }
2147 2142
2148 - (BOOL)isTabbedWindow { 2143 - (BOOL)isTabbedWindow {
2149 return browser_->is_type_tabbed(); 2144 return browser_->is_type_tabbed();
2150 } 2145 }
2151 2146
2152 @end // @implementation BrowserWindowController(WindowType) 2147 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« 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