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 <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 | 8 |
9 #include "app/mac/scoped_nsdisable_screen_updates.h" | 9 #include "app/mac/scoped_nsdisable_screen_updates.h" |
10 #include "app/mac/nsimage_cache.h" | 10 #include "app/mac/nsimage_cache.h" |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 SEL action = [item action]; | 1000 SEL action = [item action]; |
1001 BOOL enable = NO; | 1001 BOOL enable = NO; |
1002 if (action == @selector(commandDispatch:) || | 1002 if (action == @selector(commandDispatch:) || |
1003 action == @selector(commandDispatchUsingKeyModifiers:)) { | 1003 action == @selector(commandDispatchUsingKeyModifiers:)) { |
1004 NSInteger tag = [item tag]; | 1004 NSInteger tag = [item tag]; |
1005 if (browser_->command_updater()->SupportsCommand(tag)) { | 1005 if (browser_->command_updater()->SupportsCommand(tag)) { |
1006 // Generate return value (enabled state) | 1006 // Generate return value (enabled state) |
1007 enable = browser_->command_updater()->IsCommandEnabled(tag); | 1007 enable = browser_->command_updater()->IsCommandEnabled(tag); |
1008 switch (tag) { | 1008 switch (tag) { |
1009 case IDC_CLOSE_TAB: | 1009 case IDC_CLOSE_TAB: |
1010 // Disable "close tab" if we're not the key window or if there's only | 1010 // Disable "close tab" if we're not the key window. |
1011 // one tab. | 1011 enable &= [[self window] isKeyWindow]; |
1012 enable &= [self numberOfTabs] > 1 && [[self window] isKeyWindow]; | |
1013 break; | 1012 break; |
1014 case IDC_FULLSCREEN: { | 1013 case IDC_FULLSCREEN: { |
1015 enable &= [self supportsFullscreen]; | 1014 enable &= [self supportsFullscreen]; |
1016 if ([static_cast<NSObject*>(item) isKindOfClass:[NSMenuItem class]]) { | 1015 if ([static_cast<NSObject*>(item) isKindOfClass:[NSMenuItem class]]) { |
1017 NSString* menuTitle = l10n_util::GetNSString( | 1016 NSString* menuTitle = l10n_util::GetNSString( |
1018 [self isFullscreen] ? IDS_EXIT_FULLSCREEN_MAC : | 1017 [self isFullscreen] ? IDS_EXIT_FULLSCREEN_MAC : |
1019 IDS_ENTER_FULLSCREEN_MAC); | 1018 IDS_ENTER_FULLSCREEN_MAC); |
1020 [static_cast<NSMenuItem*>(item) setTitle:menuTitle]; | 1019 [static_cast<NSMenuItem*>(item) setTitle:menuTitle]; |
1021 } | 1020 } |
1022 break; | 1021 break; |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2197 | 2196 |
2198 - (BOOL)supportsBookmarkBar { | 2197 - (BOOL)supportsBookmarkBar { |
2199 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2198 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2200 } | 2199 } |
2201 | 2200 |
2202 - (BOOL)isTabbedWindow { | 2201 - (BOOL)isTabbedWindow { |
2203 return browser_->is_type_tabbed(); | 2202 return browser_->is_type_tabbed(); |
2204 } | 2203 } |
2205 | 2204 |
2206 @end // @implementation BrowserWindowController(WindowType) | 2205 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |