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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 break; | 554 break; |
555 case IDC_HELP_PAGE_VIA_MENU: | 555 case IDC_HELP_PAGE_VIA_MENU: |
556 ShowHelp(browser_, HELP_SOURCE_MENU); | 556 ShowHelp(browser_, HELP_SOURCE_MENU); |
557 break; | 557 break; |
558 case IDC_SHOW_SYNC_SETUP: | 558 case IDC_SHOW_SYNC_SETUP: |
559 ShowSyncSetup(browser_, SyncPromoUI::SOURCE_MENU); | 559 ShowSyncSetup(browser_, SyncPromoUI::SOURCE_MENU); |
560 break; | 560 break; |
561 case IDC_TOGGLE_SPEECH_INPUT: | 561 case IDC_TOGGLE_SPEECH_INPUT: |
562 ToggleSpeechInput(browser_); | 562 ToggleSpeechInput(browser_); |
563 break; | 563 break; |
564 | 564 case IDC_SELECT_PREVIOUS_MRU_TAB: |
| 565 SelectPreviousMRUTab(browser_); |
| 566 break; |
565 default: | 567 default: |
566 LOG(WARNING) << "Received Unimplemented Command: " << id; | 568 LOG(WARNING) << "Received Unimplemented Command: " << id; |
567 break; | 569 break; |
568 } | 570 } |
569 } | 571 } |
570 | 572 |
571 //////////////////////////////////////////////////////////////////////////////// | 573 //////////////////////////////////////////////////////////////////////////////// |
572 // BrowserCommandController, content::NotificationObserver implementation: | 574 // BrowserCommandController, content::NotificationObserver implementation: |
573 | 575 |
574 void BrowserCommandController::Observe( | 576 void BrowserCommandController::Observe( |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true); | 804 command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true); |
803 command_updater_.UpdateCommandEnabled(IDC_VIEW_INCOMPATIBILITIES, true); | 805 command_updater_.UpdateCommandEnabled(IDC_VIEW_INCOMPATIBILITIES, true); |
804 | 806 |
805 // View Background Pages entry is always enabled, but is hidden if there are | 807 // View Background Pages entry is always enabled, but is hidden if there are |
806 // no background pages. | 808 // no background pages. |
807 command_updater_.UpdateCommandEnabled(IDC_VIEW_BACKGROUND_PAGES, true); | 809 command_updater_.UpdateCommandEnabled(IDC_VIEW_BACKGROUND_PAGES, true); |
808 | 810 |
809 // Toggle speech input | 811 // Toggle speech input |
810 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_SPEECH_INPUT, true); | 812 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_SPEECH_INPUT, true); |
811 | 813 |
| 814 // MRU Tab Controller |
| 815 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_MRU_TAB, true); |
| 816 |
812 // Initialize other commands whose state changes based on fullscreen mode. | 817 // Initialize other commands whose state changes based on fullscreen mode. |
813 UpdateCommandsForFullscreenMode(FULLSCREEN_DISABLED); | 818 UpdateCommandsForFullscreenMode(FULLSCREEN_DISABLED); |
814 | 819 |
815 UpdateCommandsForContentRestrictionState(); | 820 UpdateCommandsForContentRestrictionState(); |
816 | 821 |
817 UpdateCommandsForBookmarkEditing(); | 822 UpdateCommandsForBookmarkEditing(); |
818 | 823 |
819 UpdateCommandsForIncognitoAvailability(); | 824 UpdateCommandsForIncognitoAvailability(); |
| 825 |
820 } | 826 } |
821 | 827 |
822 void BrowserCommandController::UpdateCommandsForIncognitoAvailability() { | 828 void BrowserCommandController::UpdateCommandsForIncognitoAvailability() { |
823 IncognitoModePrefs::Availability incognito_availability = | 829 IncognitoModePrefs::Availability incognito_availability = |
824 IncognitoModePrefs::GetAvailability(profile()->GetPrefs()); | 830 IncognitoModePrefs::GetAvailability(profile()->GetPrefs()); |
825 command_updater_.UpdateCommandEnabled( | 831 command_updater_.UpdateCommandEnabled( |
826 IDC_NEW_WINDOW, | 832 IDC_NEW_WINDOW, |
827 incognito_availability != IncognitoModePrefs::FORCED); | 833 incognito_availability != IncognitoModePrefs::FORCED); |
828 command_updater_.UpdateCommandEnabled( | 834 command_updater_.UpdateCommandEnabled( |
829 IDC_NEW_INCOGNITO_WINDOW, | 835 IDC_NEW_INCOGNITO_WINDOW, |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 | 1072 |
1067 BrowserWindow* BrowserCommandController::window() { | 1073 BrowserWindow* BrowserCommandController::window() { |
1068 return browser_->window(); | 1074 return browser_->window(); |
1069 } | 1075 } |
1070 | 1076 |
1071 Profile* BrowserCommandController::profile() { | 1077 Profile* BrowserCommandController::profile() { |
1072 return browser_->profile(); | 1078 return browser_->profile(); |
1073 } | 1079 } |
1074 | 1080 |
1075 } // namespace chrome | 1081 } // namespace chrome |
OLD | NEW |