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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 break; | 536 break; |
537 case IDC_VIEW_PASSWORDS: | 537 case IDC_VIEW_PASSWORDS: |
538 ShowPasswordManager(browser_); | 538 ShowPasswordManager(browser_); |
539 break; | 539 break; |
540 case IDC_CLEAR_BROWSING_DATA: | 540 case IDC_CLEAR_BROWSING_DATA: |
541 ShowClearBrowsingDataDialog(browser_); | 541 ShowClearBrowsingDataDialog(browser_); |
542 break; | 542 break; |
543 case IDC_IMPORT_SETTINGS: | 543 case IDC_IMPORT_SETTINGS: |
544 ShowImportDialog(browser_); | 544 ShowImportDialog(browser_); |
545 break; | 545 break; |
| 546 case IDC_TOGGLE_REQUEST_TABLET_SITE: |
| 547 ToggleRequestTabletSite(browser_); |
| 548 break; |
546 case IDC_ABOUT: | 549 case IDC_ABOUT: |
547 ShowAboutChrome(browser_); | 550 ShowAboutChrome(browser_); |
548 break; | 551 break; |
549 case IDC_UPGRADE_DIALOG: | 552 case IDC_UPGRADE_DIALOG: |
550 OpenUpdateChromeDialog(browser_); | 553 OpenUpdateChromeDialog(browser_); |
551 break; | 554 break; |
552 case IDC_VIEW_INCOMPATIBILITIES: | 555 case IDC_VIEW_INCOMPATIBILITIES: |
553 ShowConflicts(browser_); | 556 ShowConflicts(browser_); |
554 break; | 557 break; |
555 case IDC_HELP_PAGE_VIA_KEYBOARD: | 558 case IDC_HELP_PAGE_VIA_KEYBOARD: |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, CanOpenTaskManager()); | 751 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, CanOpenTaskManager()); |
749 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); | 752 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); |
750 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); | 753 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); |
751 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_KEYBOARD, true); | 754 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_KEYBOARD, true); |
752 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_MENU, true); | 755 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_MENU, true); |
753 command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU, true); | 756 command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU, true); |
754 | 757 |
755 command_updater_.UpdateCommandEnabled( | 758 command_updater_.UpdateCommandEnabled( |
756 IDC_SHOW_SYNC_SETUP, profile()->GetOriginalProfile()->IsSyncAccessible()); | 759 IDC_SHOW_SYNC_SETUP, profile()->GetOriginalProfile()->IsSyncAccessible()); |
757 | 760 |
| 761 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_REQUEST_TABLET_SITE, true); |
| 762 |
758 // Initialize other commands based on the window type. | 763 // Initialize other commands based on the window type. |
759 bool normal_window = browser_->is_type_tabbed(); | 764 bool normal_window = browser_->is_type_tabbed(); |
760 | 765 |
761 // Navigation commands | 766 // Navigation commands |
762 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); | 767 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); |
763 | 768 |
764 // Window management commands | 769 // Window management commands |
765 // TODO(rohitrao): Disable fullscreen on non-Lion? | 770 // TODO(rohitrao): Disable fullscreen on non-Lion? |
766 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, | 771 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, |
767 !(browser_->is_type_panel() && browser_->is_app())); | 772 !(browser_->is_type_panel() && browser_->is_app())); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 | 901 |
897 // Show various bits of UI | 902 // Show various bits of UI |
898 // TODO(pinkerton): Disable app-mode in the model until we implement it | 903 // TODO(pinkerton): Disable app-mode in the model until we implement it |
899 // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148 | 904 // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148 |
900 #if !defined(OS_MACOSX) | 905 #if !defined(OS_MACOSX) |
901 command_updater_.UpdateCommandEnabled( | 906 command_updater_.UpdateCommandEnabled( |
902 IDC_CREATE_SHORTCUTS, | 907 IDC_CREATE_SHORTCUTS, |
903 CanCreateApplicationShortcuts(browser_)); | 908 CanCreateApplicationShortcuts(browser_)); |
904 #endif | 909 #endif |
905 | 910 |
| 911 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_REQUEST_TABLET_SITE, |
| 912 CanRequestTabletSite(browser_)); |
| 913 |
906 UpdateCommandsForContentRestrictionState(); | 914 UpdateCommandsForContentRestrictionState(); |
907 UpdateCommandsForBookmarkEditing(); | 915 UpdateCommandsForBookmarkEditing(); |
908 } | 916 } |
909 | 917 |
910 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { | 918 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { |
911 int restrictions = GetContentRestrictions(browser_); | 919 int restrictions = GetContentRestrictions(browser_); |
912 | 920 |
913 command_updater_.UpdateCommandEnabled( | 921 command_updater_.UpdateCommandEnabled( |
914 IDC_COPY, !(restrictions & content::CONTENT_RESTRICTION_COPY)); | 922 IDC_COPY, !(restrictions & content::CONTENT_RESTRICTION_COPY)); |
915 command_updater_.UpdateCommandEnabled( | 923 command_updater_.UpdateCommandEnabled( |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 | 1080 |
1073 BrowserWindow* BrowserCommandController::window() { | 1081 BrowserWindow* BrowserCommandController::window() { |
1074 return browser_->window(); | 1082 return browser_->window(); |
1075 } | 1083 } |
1076 | 1084 |
1077 Profile* BrowserCommandController::profile() { | 1085 Profile* BrowserCommandController::profile() { |
1078 return browser_->profile(); | 1086 return browser_->profile(); |
1079 } | 1087 } |
1080 | 1088 |
1081 } // namespace chrome | 1089 } // namespace chrome |
OLD | NEW |