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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 break; | 758 break; |
759 case IDC_HELP_PAGE_VIA_MENU: | 759 case IDC_HELP_PAGE_VIA_MENU: |
760 ShowHelp(browser_, HELP_SOURCE_MENU); | 760 ShowHelp(browser_, HELP_SOURCE_MENU); |
761 break; | 761 break; |
762 case IDC_SHOW_SIGNIN: | 762 case IDC_SHOW_SIGNIN: |
763 ShowBrowserSignin(browser_, signin::SOURCE_MENU); | 763 ShowBrowserSignin(browser_, signin::SOURCE_MENU); |
764 break; | 764 break; |
765 case IDC_TOGGLE_SPEECH_INPUT: | 765 case IDC_TOGGLE_SPEECH_INPUT: |
766 ToggleSpeechInput(browser_); | 766 ToggleSpeechInput(browser_); |
767 break; | 767 break; |
| 768 case IDC_DISTILL_PAGE: |
| 769 DistillCurrentPage(browser_); |
| 770 break; |
768 | 771 |
769 default: | 772 default: |
770 LOG(WARNING) << "Received Unimplemented Command: " << id; | 773 LOG(WARNING) << "Received Unimplemented Command: " << id; |
771 break; | 774 break; |
772 } | 775 } |
773 } | 776 } |
774 | 777 |
775 //////////////////////////////////////////////////////////////////////////////// | 778 //////////////////////////////////////////////////////////////////////////////// |
776 // BrowserCommandController, SigninPrefObserver implementation: | 779 // BrowserCommandController, SigninPrefObserver implementation: |
777 | 780 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 command_updater_.UpdateCommandEnabled(restart_mode, normal_window); | 1004 command_updater_.UpdateCommandEnabled(restart_mode, normal_window); |
1002 #endif | 1005 #endif |
1003 | 1006 |
1004 // These are always enabled; the menu determines their menu item visibility. | 1007 // These are always enabled; the menu determines their menu item visibility. |
1005 command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true); | 1008 command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true); |
1006 command_updater_.UpdateCommandEnabled(IDC_VIEW_INCOMPATIBILITIES, true); | 1009 command_updater_.UpdateCommandEnabled(IDC_VIEW_INCOMPATIBILITIES, true); |
1007 | 1010 |
1008 // Toggle speech input | 1011 // Toggle speech input |
1009 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_SPEECH_INPUT, true); | 1012 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_SPEECH_INPUT, true); |
1010 | 1013 |
| 1014 // Distill current page. |
| 1015 command_updater_.UpdateCommandEnabled( |
| 1016 IDC_DISTILL_PAGE, |
| 1017 CommandLine::ForCurrentProcess()->HasSwitch( |
| 1018 switches::kEnableDomDistiller)); |
| 1019 |
1011 // Initialize other commands whose state changes based on various conditions. | 1020 // Initialize other commands whose state changes based on various conditions. |
1012 UpdateCommandsForFullscreenMode(); | 1021 UpdateCommandsForFullscreenMode(); |
1013 UpdateCommandsForContentRestrictionState(); | 1022 UpdateCommandsForContentRestrictionState(); |
1014 UpdateCommandsForBookmarkEditing(); | 1023 UpdateCommandsForBookmarkEditing(); |
1015 UpdateCommandsForIncognitoAvailability(); | 1024 UpdateCommandsForIncognitoAvailability(); |
1016 } | 1025 } |
1017 | 1026 |
1018 // static | 1027 // static |
1019 void BrowserCommandController::UpdateSharedCommandsForIncognitoAvailability( | 1028 void BrowserCommandController::UpdateSharedCommandsForIncognitoAvailability( |
1020 CommandUpdater* command_updater, | 1029 CommandUpdater* command_updater, |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 | 1328 |
1320 BrowserWindow* BrowserCommandController::window() { | 1329 BrowserWindow* BrowserCommandController::window() { |
1321 return browser_->window(); | 1330 return browser_->window(); |
1322 } | 1331 } |
1323 | 1332 |
1324 Profile* BrowserCommandController::profile() { | 1333 Profile* BrowserCommandController::profile() { |
1325 return browser_->profile(); | 1334 return browser_->profile(); |
1326 } | 1335 } |
1327 | 1336 |
1328 } // namespace chrome | 1337 } // namespace chrome |
OLD | NEW |