OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <Carbon/Carbon.h> | 5 #include <Carbon/Carbon.h> |
6 | 6 |
7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
8 #include "base/scoped_nsdisable_screen_updates.h" | 8 #include "base/scoped_nsdisable_screen_updates.h" |
9 #import "base/scoped_nsobject.h" | 9 #import "base/scoped_nsobject.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
572 enable &= [self numberOfTabs] > 1 && [[self window] isKeyWindow]; | 572 enable &= [self numberOfTabs] > 1 && [[self window] isKeyWindow]; |
573 break; | 573 break; |
574 case IDC_RESTORE_TAB: | 574 case IDC_RESTORE_TAB: |
575 // We have to ask the Browser manually if we can restore. The | 575 // We have to ask the Browser manually if we can restore. The |
576 // command updater doesn't know. | 576 // command updater doesn't know. |
577 enable &= browser_->CanRestoreTab(); | 577 enable &= browser_->CanRestoreTab(); |
578 break; | 578 break; |
579 case IDC_FULLSCREEN: | 579 case IDC_FULLSCREEN: |
580 enable &= [self supportsFullscreen]; | 580 enable &= [self supportsFullscreen]; |
581 break; | 581 break; |
582 default: | |
583 // Special handling for the contents of the Text Encoding submenu. On | |
584 // Mac OS, instead of enabling/disabling the top-level menu item, we | |
585 // enable/disable the submenu's contents (per Apple's HIG). | |
586 EncodingMenuController encoding_controller; | |
TVL
2009/11/03 18:26:28
how expensive is constructing one of these, should
| |
587 if (encoding_controller.DoesCommandBelongToEncodingMenu(tag)) { | |
588 enable &= browser_->command_updater()->IsCommandEnabled( | |
589 IDC_ENCODING_MENU) ? YES : NO; | |
590 } | |
582 } | 591 } |
583 | 592 |
584 // If the item is toggleable, find its toggle state and | 593 // If the item is toggleable, find its toggle state and |
585 // try to update it. This is a little awkward, but the alternative is | 594 // try to update it. This is a little awkward, but the alternative is |
586 // to check after a commandDispatch, which seems worse. | 595 // to check after a commandDispatch, which seems worse. |
587 [self updateToggleStateWithTag:tag forItem:item]; | 596 [self updateToggleStateWithTag:tag forItem:item]; |
588 } | 597 } |
589 } | 598 } |
590 return enable; | 599 return enable; |
591 } | 600 } |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1534 if (frameOverlayInactiveImage) { | 1543 if (frameOverlayInactiveImage) { |
1535 [theme setValue:frameOverlayInactiveImage | 1544 [theme setValue:frameOverlayInactiveImage |
1536 forAttribute:@"overlay" | 1545 forAttribute:@"overlay" |
1537 style:GTMThemeStyleWindow | 1546 style:GTMThemeStyleWindow |
1538 state:GTMThemeStateInactiveWindow]; | 1547 state:GTMThemeStateInactiveWindow]; |
1539 } | 1548 } |
1540 | 1549 |
1541 return theme; | 1550 return theme; |
1542 } | 1551 } |
1543 @end | 1552 @end |
OLD | NEW |