Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Unified Diff: chrome/browser/ui/browser_command_controller.cc

Issue 2689383002: Commands should have consistent behaviors across different modes
Patch Set: Resolve review comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/browser_command_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_command_controller.cc
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index b59372d2c58d305beef3ecd49f680e4c1cefacf8..8b2104fd27d8a23c8f58ac042983780167728e30 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -889,6 +889,11 @@ void BrowserCommandController::UpdateCommandsForIncognitoAvailability() {
command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, false);
command_updater_.UpdateCommandEnabled(IDC_OPTIONS, false);
}
+
+ if (window() && window()->IsFullscreen()) {
+ command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW, false);
+ command_updater_.UpdateCommandEnabled(IDC_NEW_INCOGNITO_WINDOW, false);
+ }
}
void BrowserCommandController::UpdateCommandsForTabState() {
@@ -1049,16 +1054,6 @@ void BrowserCommandController::UpdateCommandsForFullscreenMode() {
#endif
UpdateShowSyncState(show_main_ui);
- // Settings page/subpages are forced to open in normal mode. We disable these
- // commands for guest sessions and when incognito is forced.
- const bool options_enabled = show_main_ui &&
- IncognitoModePrefs::GetAvailability(
- profile()->GetPrefs()) != IncognitoModePrefs::FORCED;
- const bool guest_session = profile()->IsGuestSession();
- command_updater_.UpdateCommandEnabled(IDC_OPTIONS, options_enabled);
- command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS,
- options_enabled && !guest_session);
-
command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui);
@@ -1081,16 +1076,14 @@ void BrowserCommandController::UpdateCommandsForFullscreenMode() {
command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, !is_fullscreen);
command_updater_.UpdateCommandEnabled(IDC_CLOSE_WINDOW, !is_fullscreen);
- command_updater_.UpdateCommandEnabled(IDC_NEW_INCOGNITO_WINDOW,
- !is_fullscreen);
command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, !is_fullscreen);
- command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW, !is_fullscreen);
- command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, !is_fullscreen);
command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, !is_fullscreen);
command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB,
!is_fullscreen);
UpdateCommandsForBookmarkBar();
+ UpdateCommandsForIncognitoAvailability();
+ UpdateTabRestoreCommandState();
}
void BrowserCommandController::UpdatePrintingState() {
@@ -1129,15 +1122,16 @@ void BrowserCommandController::UpdateReloadStopState(bool is_loading,
}
void BrowserCommandController::UpdateTabRestoreCommandState() {
+ const bool is_fullscreen = window() && window()->IsFullscreen();
sessions::TabRestoreService* tab_restore_service =
TabRestoreServiceFactory::GetForProfile(profile());
// The command is enabled if the service hasn't loaded yet to trigger loading.
// The command is updated once the load completes.
command_updater_.UpdateCommandEnabled(
IDC_RESTORE_TAB,
- tab_restore_service &&
- (!tab_restore_service->IsLoaded() ||
- GetRestoreTabType(browser_) != TabStripModelDelegate::RESTORE_NONE));
+ !is_fullscreen && tab_restore_service &&
+ (!tab_restore_service->IsLoaded() ||
+ GetRestoreTabType(browser_) != TabStripModelDelegate::RESTORE_NONE));
}
void BrowserCommandController::UpdateCommandsForFind() {
« no previous file with comments | « no previous file | chrome/browser/ui/browser_command_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698