| OLD | NEW |
| 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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 SEL action = [item action]; | 993 SEL action = [item action]; |
| 994 BOOL enable = NO; | 994 BOOL enable = NO; |
| 995 if (action == @selector(commandDispatch:) || | 995 if (action == @selector(commandDispatch:) || |
| 996 action == @selector(commandDispatchUsingKeyModifiers:)) { | 996 action == @selector(commandDispatchUsingKeyModifiers:)) { |
| 997 NSInteger tag = [item tag]; | 997 NSInteger tag = [item tag]; |
| 998 if (browser_->command_updater()->SupportsCommand(tag)) { | 998 if (browser_->command_updater()->SupportsCommand(tag)) { |
| 999 // Generate return value (enabled state) | 999 // Generate return value (enabled state) |
| 1000 enable = browser_->command_updater()->IsCommandEnabled(tag); | 1000 enable = browser_->command_updater()->IsCommandEnabled(tag); |
| 1001 switch (tag) { | 1001 switch (tag) { |
| 1002 case IDC_CLOSE_TAB: | 1002 case IDC_CLOSE_TAB: |
| 1003 // Disable "close tab" if we're not the key window or if there's only | 1003 // Disable "close tab" if the receiving window is not tabbed. |
| 1004 // one tab. | 1004 // We simply check whether the item has a keyboard shortcut set here; |
| 1005 enable &= [[self window] isKeyWindow]; | 1005 // app_controller_mac.mm actually determines whether the item should |
| 1006 // be enabled. |
| 1007 if ([static_cast<NSObject*>(item) isKindOfClass:[NSMenuItem class]]) |
| 1008 enable &= !![[static_cast<NSMenuItem*>(item) keyEquivalent] length]; |
| 1006 break; | 1009 break; |
| 1007 case IDC_FULLSCREEN: { | 1010 case IDC_FULLSCREEN: { |
| 1008 enable &= [self supportsFullscreen]; | 1011 enable &= [self supportsFullscreen]; |
| 1009 if ([static_cast<NSObject*>(item) isKindOfClass:[NSMenuItem class]]) { | 1012 if ([static_cast<NSObject*>(item) isKindOfClass:[NSMenuItem class]]) { |
| 1010 NSString* menuTitle = l10n_util::GetNSString( | 1013 NSString* menuTitle = l10n_util::GetNSString( |
| 1011 [self isFullscreen] ? IDS_EXIT_FULLSCREEN_MAC : | 1014 [self isFullscreen] ? IDS_EXIT_FULLSCREEN_MAC : |
| 1012 IDS_ENTER_FULLSCREEN_MAC); | 1015 IDS_ENTER_FULLSCREEN_MAC); |
| 1013 [static_cast<NSMenuItem*>(item) setTitle:menuTitle]; | 1016 [static_cast<NSMenuItem*>(item) setTitle:menuTitle]; |
| 1014 | 1017 |
| 1015 if (base::mac::IsOSSnowLeopardOrEarlier()) | 1018 if (base::mac::IsOSSnowLeopardOrEarlier()) |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 | 2171 |
| 2169 - (BOOL)supportsBookmarkBar { | 2172 - (BOOL)supportsBookmarkBar { |
| 2170 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2173 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2171 } | 2174 } |
| 2172 | 2175 |
| 2173 - (BOOL)isTabbedWindow { | 2176 - (BOOL)isTabbedWindow { |
| 2174 return browser_->is_type_tabbed(); | 2177 return browser_->is_type_tabbed(); |
| 2175 } | 2178 } |
| 2176 | 2179 |
| 2177 @end // @implementation BrowserWindowController(WindowType) | 2180 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |