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 16d4f41bebdb622578dfeb53d31d82fa48971bf4..762fc4023cb4083f60773a139f98c55c89919f01 100644 |
--- a/chrome/browser/ui/browser_command_controller.cc |
+++ b/chrome/browser/ui/browser_command_controller.cc |
@@ -60,6 +60,18 @@ using content::WebContents; |
namespace { |
+enum FullScreenMode { |
+ // Not in fullscreen mode. |
+ FULLSCREEN_DISABLED, |
sky
2013/08/22 21:33:55
Am I the only one that finds this name totally mis
scheib
2013/08/22 23:57:26
WINDOW_STATE_NORMAL,
WINDOW_STATE_FULLSCREEN,
WIND
sky
2013/08/23 00:00:37
Much better, but NORMAL is a bit ambiguous here, I
bartfab (slow)
2013/08/23 11:54:21
Done.
|
+ |
+ // Fullscreen mode, occupying the whole screen. |
+ FULLSCREEN_NORMAL, |
+ |
+ // Fullscreen mode for metro snap, occupying the full height and 20% of |
+ // the screen width. |
+ FULLSCREEN_METRO_SNAP, |
+}; |
+ |
// Returns |true| if entry has an internal chrome:// URL, |false| otherwise. |
bool HasInternalURL(const NavigationEntry* entry) { |
if (!entry) |
@@ -197,6 +209,12 @@ BrowserCommandController::BrowserCommandController( |
prefs::kPrintingEnabled, |
base::Bind(&BrowserCommandController::UpdatePrintingState, |
base::Unretained(this))); |
+#if !defined(OS_MACOSX) |
+ profile_pref_registrar_.Add( |
+ prefs::kFullscreenAllowed, |
+ base::Bind(&BrowserCommandController::UpdateCommandsForFullscreenMode, |
+ base::Unretained(this))); |
+#endif |
pref_signin_allowed_.Init( |
prefs::kSigninAllowed, |
profile()->GetOriginalProfile()->GetPrefs(), |
@@ -286,16 +304,7 @@ void BrowserCommandController::ContentRestrictionsChanged() { |
} |
void BrowserCommandController::FullscreenStateChanged() { |
- FullScreenMode fullscreen_mode = FULLSCREEN_DISABLED; |
- if (window()->IsFullscreen()) { |
-#if defined(OS_WIN) |
- fullscreen_mode = window()->IsInMetroSnapMode() ? FULLSCREEN_METRO_SNAP : |
- FULLSCREEN_NORMAL; |
-#else |
- fullscreen_mode = FULLSCREEN_NORMAL; |
-#endif |
- } |
- UpdateCommandsForFullscreenMode(fullscreen_mode); |
+ UpdateCommandsForFullscreenMode(); |
} |
void BrowserCommandController::PrintingStateChanged() { |
@@ -936,7 +945,7 @@ void BrowserCommandController::InitCommandState() { |
command_updater_.UpdateCommandEnabled(IDC_TOGGLE_SPEECH_INPUT, true); |
// Initialize other commands whose state changes based on fullscreen mode. |
- UpdateCommandsForFullscreenMode(FULLSCREEN_DISABLED); |
+ UpdateCommandsForFullscreenMode(); |
UpdateCommandsForContentRestrictionState(); |
@@ -1087,8 +1096,16 @@ void BrowserCommandController::UpdateCommandsForFileSelectionDialogs() { |
UpdateOpenFileState(&command_updater_); |
} |
-void BrowserCommandController::UpdateCommandsForFullscreenMode( |
- FullScreenMode fullscreen_mode) { |
+void BrowserCommandController::UpdateCommandsForFullscreenMode() { |
+ FullScreenMode fullscreen_mode = FULLSCREEN_DISABLED; |
+ if (window() && window()->IsFullscreen()) { |
+#if defined(OS_WIN) |
+ fullscreen_mode = window()->IsInMetroSnapMode() ? FULLSCREEN_METRO_SNAP : |
+ FULLSCREEN_NORMAL; |
+#else |
+ fullscreen_mode = FULLSCREEN_NORMAL; |
+#endif |
+ } |
bool show_main_ui = IsShowingMainUI(); |
bool main_not_fullscreen = show_main_ui && |
(fullscreen_mode == FULLSCREEN_DISABLED); |
@@ -1145,6 +1162,12 @@ void BrowserCommandController::UpdateCommandsForFullscreenMode( |
int tab_index = chrome::IndexOfFirstBlockedTab(browser_->tab_strip_model()); |
bool has_blocked_tab = tab_index != browser_->tab_strip_model()->count(); |
fullscreen_enabled &= !has_blocked_tab; |
+#else |
+ if (fullscreen_mode == FULLSCREEN_DISABLED && |
+ !profile()->GetPrefs()->GetBoolean(prefs::kFullscreenAllowed)) { |
+ // Disable toggling into fullscreen mode if disallowed by pref. |
+ fullscreen_enabled = false; |
+ } |
#endif |
command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, fullscreen_enabled); |