OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/browser_command_controller.h" | 5 #include "chrome/browser/ui/browser_command_controller.h" |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/defaults.h" | 9 #include "chrome/browser/defaults.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 break; | 542 break; |
543 case IDC_VIEW_PASSWORDS: | 543 case IDC_VIEW_PASSWORDS: |
544 ShowPasswordManager(browser_); | 544 ShowPasswordManager(browser_); |
545 break; | 545 break; |
546 case IDC_CLEAR_BROWSING_DATA: | 546 case IDC_CLEAR_BROWSING_DATA: |
547 ShowClearBrowsingDataDialog(browser_); | 547 ShowClearBrowsingDataDialog(browser_); |
548 break; | 548 break; |
549 case IDC_IMPORT_SETTINGS: | 549 case IDC_IMPORT_SETTINGS: |
550 ShowImportDialog(browser_); | 550 ShowImportDialog(browser_); |
551 break; | 551 break; |
552 case IDC_TOGGLE_REQUEST_TABLET_SITE: | |
553 ToggleRequestTabletSite(browser_); | |
554 break; | |
552 case IDC_ABOUT: | 555 case IDC_ABOUT: |
553 ShowAboutChrome(browser_); | 556 ShowAboutChrome(browser_); |
554 break; | 557 break; |
555 case IDC_UPGRADE_DIALOG: | 558 case IDC_UPGRADE_DIALOG: |
556 OpenUpdateChromeDialog(browser_); | 559 OpenUpdateChromeDialog(browser_); |
557 break; | 560 break; |
558 case IDC_VIEW_INCOMPATIBILITIES: | 561 case IDC_VIEW_INCOMPATIBILITIES: |
559 ShowConflicts(browser_); | 562 ShowConflicts(browser_); |
560 break; | 563 break; |
561 case IDC_HELP_PAGE_VIA_KEYBOARD: | 564 case IDC_HELP_PAGE_VIA_KEYBOARD: |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, CanOpenTaskManager()); | 758 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, CanOpenTaskManager()); |
756 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); | 759 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); |
757 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); | 760 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); |
758 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_KEYBOARD, true); | 761 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_KEYBOARD, true); |
759 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_MENU, true); | 762 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_MENU, true); |
760 command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU, true); | 763 command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU, true); |
761 | 764 |
762 command_updater_.UpdateCommandEnabled( | 765 command_updater_.UpdateCommandEnabled( |
763 IDC_SHOW_SYNC_SETUP, profile()->GetOriginalProfile()->IsSyncAccessible()); | 766 IDC_SHOW_SYNC_SETUP, profile()->GetOriginalProfile()->IsSyncAccessible()); |
764 | 767 |
768 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_REQUEST_TABLET_SITE, true); | |
sky
2012/09/07 18:05:30
You have this set in UpdateCommandsForTabState, wh
sschmitz
2012/09/07 22:33:09
Removed it. Done.
| |
769 | |
765 // Initialize other commands based on the window type. | 770 // Initialize other commands based on the window type. |
766 bool normal_window = browser_->is_type_tabbed(); | 771 bool normal_window = browser_->is_type_tabbed(); |
767 | 772 |
768 // Navigation commands | 773 // Navigation commands |
769 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); | 774 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); |
770 | 775 |
771 // Window management commands | 776 // Window management commands |
772 // TODO(rohitrao): Disable fullscreen on non-Lion? | 777 // TODO(rohitrao): Disable fullscreen on non-Lion? |
773 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, | 778 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, |
774 !(browser_->is_type_panel() && browser_->is_app())); | 779 !(browser_->is_type_panel() && browser_->is_app())); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
900 | 905 |
901 // Show various bits of UI | 906 // Show various bits of UI |
902 // TODO(pinkerton): Disable app-mode in the model until we implement it | 907 // TODO(pinkerton): Disable app-mode in the model until we implement it |
903 // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148 | 908 // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148 |
904 #if !defined(OS_MACOSX) | 909 #if !defined(OS_MACOSX) |
905 command_updater_.UpdateCommandEnabled( | 910 command_updater_.UpdateCommandEnabled( |
906 IDC_CREATE_SHORTCUTS, | 911 IDC_CREATE_SHORTCUTS, |
907 CanCreateApplicationShortcuts(browser_)); | 912 CanCreateApplicationShortcuts(browser_)); |
908 #endif | 913 #endif |
909 | 914 |
915 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_REQUEST_TABLET_SITE, | |
916 CanRequestTabletSite(browser_)); | |
sky
2012/09/07 18:05:30
CanRequestTabletSite only uses the active tab cont
sschmitz
2012/09/07 22:33:09
Done.
| |
917 | |
910 UpdateCommandsForContentRestrictionState(); | 918 UpdateCommandsForContentRestrictionState(); |
911 UpdateCommandsForBookmarkEditing(); | 919 UpdateCommandsForBookmarkEditing(); |
912 } | 920 } |
913 | 921 |
914 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { | 922 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { |
915 int restrictions = GetContentRestrictions(browser_); | 923 int restrictions = GetContentRestrictions(browser_); |
916 | 924 |
917 command_updater_.UpdateCommandEnabled( | 925 command_updater_.UpdateCommandEnabled( |
918 IDC_COPY, !(restrictions & content::CONTENT_RESTRICTION_COPY)); | 926 IDC_COPY, !(restrictions & content::CONTENT_RESTRICTION_COPY)); |
919 command_updater_.UpdateCommandEnabled( | 927 command_updater_.UpdateCommandEnabled( |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1078 | 1086 |
1079 BrowserWindow* BrowserCommandController::window() { | 1087 BrowserWindow* BrowserCommandController::window() { |
1080 return browser_->window(); | 1088 return browser_->window(); |
1081 } | 1089 } |
1082 | 1090 |
1083 Profile* BrowserCommandController::profile() { | 1091 Profile* BrowserCommandController::profile() { |
1084 return browser_->profile(); | 1092 return browser_->profile(); |
1085 } | 1093 } |
1086 | 1094 |
1087 } // namespace chrome | 1095 } // namespace chrome |
OLD | NEW |