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

Unified Diff: chrome/browser/browser.cc

Issue 20423: Preliminary fullscreen mode support.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « chrome/browser/browser.h ('k') | chrome/browser/browser_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser.cc
===================================================================
--- chrome/browser/browser.cc (revision 9882)
+++ chrome/browser/browser.cc (working copy)
@@ -711,6 +711,12 @@
browser->window()->Show();
}
+void Browser::ToggleFullscreenMode() {
+ UserMetrics::RecordAction(L"ToggleFullscreen", profile_);
+ window_->SetFullscreen(!window_->IsFullscreen());
+ UpdateCommandsForFullscreenMode(window_->IsFullscreen());
+}
+
void Browser::Exit() {
UserMetrics::RecordAction(L"Exit", profile_);
BrowserList::CloseAllBrowsers(true);
@@ -1103,6 +1109,7 @@
case IDC_DUPLICATE_TAB: DuplicateTab(); break;
case IDC_RESTORE_TAB: RestoreTab(); break;
case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break;
+ case IDC_FULLSCREEN: ToggleFullscreenMode(); break;
case IDC_EXIT: Exit(); break;
// Page-related commands
@@ -1933,6 +1940,7 @@
command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, true);
command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, true);
command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, true);
+ command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, true);
command_updater_.UpdateCommandEnabled(IDC_EXIT, true);
// Page-related commands
@@ -1997,10 +2005,8 @@
// Navigation commands
command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window);
- command_updater_.UpdateCommandEnabled(IDC_OPEN_CURRENT_URL, normal_window);
// Window management commands
- command_updater_.UpdateCommandEnabled(IDC_PROFILE_MENU, normal_window);
command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, normal_window);
command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB,
normal_window);
@@ -2015,33 +2021,10 @@
command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window);
command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB,
normal_window && !profile_->IsOffTheRecord());
- command_updater_.UpdateCommandEnabled(IDC_SHOW_AS_TAB,
- (type() == TYPE_POPUP));
+ }
- // Focus various bits of UI
- command_updater_.UpdateCommandEnabled(IDC_FOCUS_TOOLBAR, normal_window);
- command_updater_.UpdateCommandEnabled(IDC_FOCUS_LOCATION, normal_window);
- command_updater_.UpdateCommandEnabled(IDC_FOCUS_SEARCH, normal_window);
-
- // Show various bits of UI
- command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, normal_window);
-#if defined(OS_WIN)
- command_updater_.UpdateCommandEnabled(IDC_DEBUGGER,
- // The debugger doesn't work in single process mode.
- normal_window && !RenderProcessHost::run_renderer_in_process());
-#endif
- command_updater_.UpdateCommandEnabled(IDC_NEW_PROFILE, normal_window);
- command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, normal_window);
- command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, normal_window);
- command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA,
- normal_window);
- command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, normal_window);
- command_updater_.UpdateCommandEnabled(IDC_OPTIONS, normal_window);
- command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES,
- normal_window);
- command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, normal_window);
- command_updater_.UpdateCommandEnabled(IDC_ABOUT, normal_window);
- }
+ // Initialize other commands whose state changes based on fullscreen mode.
+ UpdateCommandsForFullscreenMode(false);
}
void Browser::UpdateCommandsForTabState() {
@@ -2098,6 +2081,40 @@
}
}
+void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) {
+ const bool show_main_ui = (type() == TYPE_NORMAL) && !is_fullscreen;
+
+ // Navigation commands
+ command_updater_.UpdateCommandEnabled(IDC_OPEN_CURRENT_URL, show_main_ui);
+
+ // Window management commands
+ command_updater_.UpdateCommandEnabled(IDC_PROFILE_MENU, show_main_ui);
+ command_updater_.UpdateCommandEnabled(IDC_SHOW_AS_TAB,
+ (type() == TYPE_POPUP) && !is_fullscreen);
+
+ // Focus various bits of UI
+ command_updater_.UpdateCommandEnabled(IDC_FOCUS_TOOLBAR, show_main_ui);
+ command_updater_.UpdateCommandEnabled(IDC_FOCUS_LOCATION, show_main_ui);
+ command_updater_.UpdateCommandEnabled(IDC_FOCUS_SEARCH, show_main_ui);
+
+ // Show various bits of UI
+ command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, show_main_ui);
+#if defined(OS_WIN)
+ command_updater_.UpdateCommandEnabled(IDC_DEBUGGER,
+ // The debugger doesn't work in single process mode.
+ show_main_ui && !RenderProcessHost::run_renderer_in_process());
+#endif
+ command_updater_.UpdateCommandEnabled(IDC_NEW_PROFILE, show_main_ui);
+ command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui);
+ command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui);
+ command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, show_main_ui);
+ command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui);
+ command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui);
+ 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);
+}
+
void Browser::UpdateStopGoState(bool is_loading) {
window_->UpdateStopGoState(is_loading);
command_updater_.UpdateCommandEnabled(IDC_GO, !is_loading);
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698