| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 mash::mojom::LaunchMode::DEFAULT); | 639 mash::mojom::LaunchMode::DEFAULT); |
| 640 } else { | 640 } else { |
| 641 ash::accelerators::ToggleTouchHudProjection(); | 641 ash::accelerators::ToggleTouchHudProjection(); |
| 642 } | 642 } |
| 643 break; | 643 break; |
| 644 #endif | 644 #endif |
| 645 case IDC_ROUTE_MEDIA: | 645 case IDC_ROUTE_MEDIA: |
| 646 RouteMedia(browser_); | 646 RouteMedia(browser_); |
| 647 break; | 647 break; |
| 648 | 648 |
| 649 case IDC_WINDOW_DUPLICATE_TAB: |
| 650 DuplicateTab(browser_); |
| 651 break; |
| 652 case IDC_WINDOW_MUTE_TAB: |
| 653 MuteTab(browser_); |
| 654 break; |
| 655 case IDC_WINDOW_PIN_TAB: |
| 656 PinTab(browser_); |
| 657 break; |
| 658 |
| 649 default: | 659 default: |
| 650 LOG(WARNING) << "Received Unimplemented Command: " << id; | 660 LOG(WARNING) << "Received Unimplemented Command: " << id; |
| 651 break; | 661 break; |
| 652 } | 662 } |
| 653 } | 663 } |
| 654 | 664 |
| 655 //////////////////////////////////////////////////////////////////////////////// | 665 //////////////////////////////////////////////////////////////////////////////// |
| 656 // BrowserCommandController, SigninPrefObserver implementation: | 666 // BrowserCommandController, SigninPrefObserver implementation: |
| 657 | 667 |
| 658 void BrowserCommandController::OnSigninAllowedPrefChange() { | 668 void BrowserCommandController::OnSigninAllowedPrefChange() { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 | 846 |
| 837 // These are always enabled; the menu determines their menu item visibility. | 847 // These are always enabled; the menu determines their menu item visibility. |
| 838 command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true); | 848 command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true); |
| 839 command_updater_.UpdateCommandEnabled(IDC_VIEW_INCOMPATIBILITIES, true); | 849 command_updater_.UpdateCommandEnabled(IDC_VIEW_INCOMPATIBILITIES, true); |
| 840 | 850 |
| 841 // Distill current page. | 851 // Distill current page. |
| 842 command_updater_.UpdateCommandEnabled( | 852 command_updater_.UpdateCommandEnabled( |
| 843 IDC_DISTILL_PAGE, base::CommandLine::ForCurrentProcess()->HasSwitch( | 853 IDC_DISTILL_PAGE, base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 844 switches::kEnableDomDistiller)); | 854 switches::kEnableDomDistiller)); |
| 845 | 855 |
| 856 command_updater_.UpdateCommandEnabled(IDC_WINDOW_DUPLICATE_TAB, |
| 857 normal_window); |
| 858 command_updater_.UpdateCommandEnabled(IDC_WINDOW_MUTE_TAB, normal_window); |
| 859 command_updater_.UpdateCommandEnabled(IDC_WINDOW_PIN_TAB, normal_window); |
| 860 command_updater_.UpdateCommandEnabled(IDC_WINDOW_RELOAD_TAB, normal_window); |
| 861 |
| 846 // Initialize other commands whose state changes based on various conditions. | 862 // Initialize other commands whose state changes based on various conditions. |
| 847 UpdateCommandsForFullscreenMode(); | 863 UpdateCommandsForFullscreenMode(); |
| 848 UpdateCommandsForContentRestrictionState(); | 864 UpdateCommandsForContentRestrictionState(); |
| 849 UpdateCommandsForBookmarkEditing(); | 865 UpdateCommandsForBookmarkEditing(); |
| 850 UpdateCommandsForIncognitoAvailability(); | 866 UpdateCommandsForIncognitoAvailability(); |
| 851 } | 867 } |
| 852 | 868 |
| 853 // static | 869 // static |
| 854 void BrowserCommandController::UpdateSharedCommandsForIncognitoAvailability( | 870 void BrowserCommandController::UpdateSharedCommandsForIncognitoAvailability( |
| 855 CommandUpdater* command_updater, | 871 CommandUpdater* command_updater, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_)); | 927 command_updater_.UpdateCommandEnabled(IDC_FORWARD, CanGoForward(browser_)); |
| 912 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_)); | 928 command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReload(browser_)); |
| 913 command_updater_.UpdateCommandEnabled(IDC_RELOAD_BYPASSING_CACHE, | 929 command_updater_.UpdateCommandEnabled(IDC_RELOAD_BYPASSING_CACHE, |
| 914 CanReload(browser_)); | 930 CanReload(browser_)); |
| 915 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE, | 931 command_updater_.UpdateCommandEnabled(IDC_RELOAD_CLEARING_CACHE, |
| 916 CanReload(browser_)); | 932 CanReload(browser_)); |
| 917 | 933 |
| 918 // Window management commands | 934 // Window management commands |
| 919 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, | 935 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, |
| 920 !browser_->is_app() && CanDuplicateTab(browser_)); | 936 !browser_->is_app() && CanDuplicateTab(browser_)); |
| 937 command_updater_.UpdateCommandEnabled( |
| 938 IDC_WINDOW_DUPLICATE_TAB, |
| 939 !browser_->is_app() && CanDuplicateTab(browser_)); |
| 940 command_updater_.UpdateCommandEnabled(IDC_WINDOW_MUTE_TAB, |
| 941 !browser_->is_app()); |
| 942 command_updater_.UpdateCommandEnabled(IDC_WINDOW_PIN_TAB, |
| 943 !browser_->is_app()); |
| 921 | 944 |
| 922 // Page-related commands | 945 // Page-related commands |
| 923 window()->SetStarredState( | 946 window()->SetStarredState( |
| 924 BookmarkTabHelper::FromWebContents(current_web_contents)->is_starred()); | 947 BookmarkTabHelper::FromWebContents(current_web_contents)->is_starred()); |
| 925 window()->ZoomChangedForActiveTab(false); | 948 window()->ZoomChangedForActiveTab(false); |
| 926 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, | 949 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, |
| 927 CanViewSource(browser_)); | 950 CanViewSource(browser_)); |
| 928 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, | 951 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, |
| 929 CanEmailPageLocation(browser_)); | 952 CanEmailPageLocation(browser_)); |
| 930 if (browser_->is_devtools()) | 953 if (browser_->is_devtools()) |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 | 1173 |
| 1151 BrowserWindow* BrowserCommandController::window() { | 1174 BrowserWindow* BrowserCommandController::window() { |
| 1152 return browser_->window(); | 1175 return browser_->window(); |
| 1153 } | 1176 } |
| 1154 | 1177 |
| 1155 Profile* BrowserCommandController::profile() { | 1178 Profile* BrowserCommandController::profile() { |
| 1156 return browser_->profile(); | 1179 return browser_->profile(); |
| 1157 } | 1180 } |
| 1158 | 1181 |
| 1159 } // namespace chrome | 1182 } // namespace chrome |
| OLD | NEW |