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

Side by Side Diff: chrome/browser/ui/browser.h

Issue 8423035: Split out fullscreen logic from Browser into FullscreenController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: replace reset() with Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/browser.cc » ('j') | chrome/browser/ui/fullscreen_controller.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_BROWSER_H_ 5 #ifndef CHROME_BROWSER_UI_BROWSER_H_
6 #define CHROME_BROWSER_UI_BROWSER_H_ 6 #define CHROME_BROWSER_UI_BROWSER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "content/public/common/page_transition_types.h" 48 #include "content/public/common/page_transition_types.h"
49 #include "content/public/common/page_zoom.h" 49 #include "content/public/common/page_zoom.h"
50 #include "ui/base/ui_base_types.h" 50 #include "ui/base/ui_base_types.h"
51 #include "ui/gfx/rect.h" 51 #include "ui/gfx/rect.h"
52 52
53 class BrowserSyncedWindowDelegate; 53 class BrowserSyncedWindowDelegate;
54 class BrowserTabRestoreServiceDelegate; 54 class BrowserTabRestoreServiceDelegate;
55 class BrowserWindow; 55 class BrowserWindow;
56 class Extension; 56 class Extension;
57 class FindBarController; 57 class FindBarController;
58 class FullscreenController;
58 class InstantController; 59 class InstantController;
59 class InstantUnloadHandler; 60 class InstantUnloadHandler;
60 class PrefService; 61 class PrefService;
61 class Profile; 62 class Profile;
62 class SessionStorageNamespace; 63 class SessionStorageNamespace;
63 class SkBitmap; 64 class SkBitmap;
64 class StatusBubble; 65 class StatusBubble;
65 class TabNavigation; 66 class TabNavigation;
66 class TabStripModel; 67 class TabStripModel;
67 struct WebApplicationInfo; 68 struct WebApplicationInfo;
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 void ShowSingletonTabOverwritingNTP(const browser::NavigateParams& params); 488 void ShowSingletonTabOverwritingNTP(const browser::NavigateParams& params);
488 489
489 // Creates a NavigateParams struct for a singleton tab navigation. 490 // Creates a NavigateParams struct for a singleton tab navigation.
490 browser::NavigateParams GetSingletonTabNavigateParams(const GURL& url); 491 browser::NavigateParams GetSingletonTabNavigateParams(const GURL& url);
491 492
492 // Invoked when the fullscreen state of the window changes. 493 // Invoked when the fullscreen state of the window changes.
493 // BrowserWindow::EnterFullscreen invokes this after the window has become 494 // BrowserWindow::EnterFullscreen invokes this after the window has become
494 // fullscreen. 495 // fullscreen.
495 void WindowFullscreenStateChanged(); 496 void WindowFullscreenStateChanged();
496 497
497 // Sends a notification that the fullscreen state has changed.
498 void NotifyFullscreenChange();
499
500 // Assorted browser commands //////////////////////////////////////////////// 498 // Assorted browser commands ////////////////////////////////////////////////
501 499
502 // NOTE: Within each of the following sections, the IDs are ordered roughly by 500 // NOTE: Within each of the following sections, the IDs are ordered roughly by
503 // how they appear in the GUI/menus (left to right, top to bottom, etc.). 501 // how they appear in the GUI/menus (left to right, top to bottom, etc.).
504 502
505 // Navigation commands 503 // Navigation commands
506 bool CanGoBack() const; 504 bool CanGoBack() const;
507 void GoBack(WindowOpenDisposition disposition); 505 void GoBack(WindowOpenDisposition disposition);
508 bool CanGoForward() const; 506 bool CanGoForward() const;
509 void GoForward(WindowOpenDisposition disposition); 507 void GoForward(WindowOpenDisposition disposition);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 int from_index, 824 int from_index,
827 int to_index); 825 int to_index);
828 virtual void TabReplacedAt(TabStripModel* tab_strip_model, 826 virtual void TabReplacedAt(TabStripModel* tab_strip_model,
829 TabContentsWrapper* old_contents, 827 TabContentsWrapper* old_contents,
830 TabContentsWrapper* new_contents, 828 TabContentsWrapper* new_contents,
831 int index); 829 int index);
832 virtual void TabPinnedStateChanged(TabContentsWrapper* contents, int index); 830 virtual void TabPinnedStateChanged(TabContentsWrapper* contents, int index);
833 virtual void TabStripEmpty(); 831 virtual void TabStripEmpty();
834 832
835 // Fullscreen permission infobar callbacks. 833 // Fullscreen permission infobar callbacks.
834 // TODO(koz): Remove this and have callers call FullscreenController directly.
836 void OnAcceptFullscreenPermission(const GURL& url, 835 void OnAcceptFullscreenPermission(const GURL& url,
837 FullscreenExitBubbleType bubble_type); 836 FullscreenExitBubbleType bubble_type);
838 void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type); 837 void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type);
839 ContentSetting GetFullscreenSetting(const GURL& url);
840 ContentSetting GetMouseLockSetting(const GURL& url);
841 838
842 // Figure out if there are tabs that have beforeunload handlers. 839 // Figure out if there are tabs that have beforeunload handlers.
843 bool TabsNeedBeforeUnloadFired(); 840 bool TabsNeedBeforeUnloadFired();
844 841
845 bool is_type_tabbed() const { return type_ == TYPE_TABBED; } 842 bool is_type_tabbed() const { return type_ == TYPE_TABBED; }
846 bool is_type_popup() const { return type_ == TYPE_POPUP; } 843 bool is_type_popup() const { return type_ == TYPE_POPUP; }
847 bool is_type_panel() const { return type_ == TYPE_PANEL; } 844 bool is_type_panel() const { return type_ == TYPE_PANEL; }
848 845
849 bool is_app() const; 846 bool is_app() const;
850 bool is_devtools() const; 847 bool is_devtools() const;
851 848
852 // True when the current tab is in fullscreen mode, requested by 849 // True when the current tab is in fullscreen mode, requested by
853 // webkitRequestFullScreen. 850 // webkitRequestFullScreen.
854 bool is_fullscreen_for_tab() const { return fullscreened_tab_ != NULL; } 851 bool IsFullscreenForTab() const;
855 852
856 // Called each time the browser window is shown. 853 // Called each time the browser window is shown.
857 void OnWindowDidShow(); 854 void OnWindowDidShow();
858 855
859 protected: 856 protected:
860 // Wrapper for the factory method in BrowserWindow. This allows subclasses to 857 // Wrapper for the factory method in BrowserWindow. This allows subclasses to
861 // set their own window. 858 // set their own window.
862 virtual BrowserWindow* CreateBrowserWindow(); 859 virtual BrowserWindow* CreateBrowserWindow();
863 860
864 private: 861 private:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 // Change is the result of the bookmark bar pref changing. 899 // Change is the result of the bookmark bar pref changing.
903 BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE, 900 BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE,
904 901
905 // Change is the result of a state change in the active tab. 902 // Change is the result of a state change in the active tab.
906 BOOKMARK_BAR_STATE_CHANGE_TAB_STATE, 903 BOOKMARK_BAR_STATE_CHANGE_TAB_STATE,
907 904
908 // Change is the result of window toggling in/out of fullscreen mode. 905 // Change is the result of window toggling in/out of fullscreen mode.
909 BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN, 906 BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN,
910 }; 907 };
911 908
912 enum MouseLockState {
913 MOUSELOCK_NOT_REQUESTED,
914 // The page requests to lock the mouse and the user hasn't responded to the
915 // request.
916 MOUSELOCK_REQUESTED,
917 // Mouse lock has been allowed by the user.
918 MOUSELOCK_ACCEPTED
919 };
920
921 // Overridden from TabContentsDelegate: 909 // Overridden from TabContentsDelegate:
922 // Deprecated. Please use two-argument variant. 910 // Deprecated. Please use two-argument variant.
923 // TODO(adriansc): Remove this method once refactoring changed all call sites. 911 // TODO(adriansc): Remove this method once refactoring changed all call sites.
924 virtual TabContents* OpenURLFromTab( 912 virtual TabContents* OpenURLFromTab(
925 TabContents* source, 913 TabContents* source,
926 const GURL& url, 914 const GURL& url,
927 const GURL& referrer, 915 const GURL& referrer,
928 WindowOpenDisposition disposition, 916 WindowOpenDisposition disposition,
929 content::PageTransition transition) OVERRIDE; 917 content::PageTransition transition) OVERRIDE;
930 virtual TabContents* OpenURLFromTab(TabContents* source, 918 virtual TabContents* OpenURLFromTab(TabContents* source,
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 // this to return NULL if called before the toolbar has initialized. 1141 // this to return NULL if called before the toolbar has initialized.
1154 // TODO(beng): remove this. 1142 // TODO(beng): remove this.
1155 StatusBubble* GetStatusBubble(); 1143 StatusBubble* GetStatusBubble();
1156 1144
1157 // Session restore functions //////////////////////////////////////////////// 1145 // Session restore functions ////////////////////////////////////////////////
1158 1146
1159 // Notifies the history database of the index for all tabs whose index is 1147 // Notifies the history database of the index for all tabs whose index is
1160 // >= index. 1148 // >= index.
1161 void SyncHistoryWithTabs(int index); 1149 void SyncHistoryWithTabs(int index);
1162 1150
1163 // Tab fullscreen functions /////////////////////////////////////////////////
1164
1165 // There are two different kinds of fullscreen mode - "tab fullscreen" and
1166 // "browser fullscreen". "Tab fullscreen" refers to when a tab enters
1167 // fullscreen mode via the JS fullscreen API, and "browser fullscreen"
1168 // refers to the user putting the browser itself into fullscreen mode from
1169 // the UI. The difference is that tab fullscreen has implications for how
1170 // the contents of the tab render (eg: a video element may grow to consume
1171 // the whole tab), whereas browser fullscreen mode doesn't. Therefore if a
1172 // user forces an exit from fullscreen, we need to notify the tab so it can
1173 // stop rendering in its fullscreen mode.
1174
1175 // Make the current tab exit fullscreen mode if it is in it.
1176 void ExitTabbedFullscreenModeIfNecessary();
1177
1178 // Notifies the tab that it has been forced out of fullscreen mode if
1179 // necessary.
1180 void NotifyTabOfFullscreenExitIfNecessary();
1181
1182 // OnBeforeUnload handling ////////////////////////////////////////////////// 1151 // OnBeforeUnload handling //////////////////////////////////////////////////
1183 1152
1184 typedef std::set<TabContents*> UnloadListenerSet; 1153 typedef std::set<TabContents*> UnloadListenerSet;
1185 1154
1186 // Processes the next tab that needs it's beforeunload/unload event fired. 1155 // Processes the next tab that needs it's beforeunload/unload event fired.
1187 void ProcessPendingTabs(); 1156 void ProcessPendingTabs();
1188 1157
1189 // Whether we've completed firing all the tabs' beforeunload/unload events. 1158 // Whether we've completed firing all the tabs' beforeunload/unload events.
1190 bool HasCompletedUnloadProcessing() const; 1159 bool HasCompletedUnloadProcessing() const;
1191 1160
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 void OpenBookmarkManagerWithHash(const std::string& action, int64 node_id); 1260 void OpenBookmarkManagerWithHash(const std::string& action, int64 node_id);
1292 1261
1293 // Make the current tab exit fullscreen mode. If the browser was fullscreen 1262 // Make the current tab exit fullscreen mode. If the browser was fullscreen
1294 // because of that (as opposed to the user clicking the fullscreen button) 1263 // because of that (as opposed to the user clicking the fullscreen button)
1295 // then take the browser out of fullscreen mode as well. 1264 // then take the browser out of fullscreen mode as well.
1296 void ExitTabbedFullscreenMode(); 1265 void ExitTabbedFullscreenMode();
1297 1266
1298 // Notifies the tab that it has been forced out of fullscreen mode. 1267 // Notifies the tab that it has been forced out of fullscreen mode.
1299 void NotifyTabOfFullscreenExit(); 1268 void NotifyTabOfFullscreenExit();
1300 1269
1301 // Determines what should be shown in the fullscreen exit bubble.
1302 FullscreenExitBubbleType GetFullscreenExitBubbleType() const;
1303
1304 // Updates the content of the fullscreen exit bubble.
1305 void UpdateFullscreenExitBubbleContent();
1306
1307 // Data members ///////////////////////////////////////////////////////////// 1270 // Data members /////////////////////////////////////////////////////////////
1308 1271
1309 content::NotificationRegistrar registrar_; 1272 content::NotificationRegistrar registrar_;
1310 1273
1311 PrefChangeRegistrar profile_pref_registrar_; 1274 PrefChangeRegistrar profile_pref_registrar_;
1312 1275
1313 PrefChangeRegistrar local_pref_registrar_; 1276 PrefChangeRegistrar local_pref_registrar_;
1314 1277
1315 // This Browser's type. 1278 // This Browser's type.
1316 const Type type_; 1279 const Type type_;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; 1400 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_;
1438 1401
1439 // Helper which implements the SyncedWindowDelegate interface. 1402 // Helper which implements the SyncedWindowDelegate interface.
1440 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; 1403 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_;
1441 1404
1442 scoped_ptr<InstantController> instant_; 1405 scoped_ptr<InstantController> instant_;
1443 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; 1406 scoped_ptr<InstantUnloadHandler> instant_unload_handler_;
1444 1407
1445 BookmarkBar::State bookmark_bar_state_; 1408 BookmarkBar::State bookmark_bar_state_;
1446 1409
1447 // If there is currently a tab in fullscreen mode (entered via 1410 scoped_refptr<FullscreenController> fullscreen_controller_;
1448 // webkitRequestFullScreen), this is its wrapper.
1449 TabContentsWrapper* fullscreened_tab_;
1450
1451 // True if the current tab entered fullscreen mode via webkitRequestFullScreen
1452 bool tab_caused_fullscreen_;
1453 // True if tab fullscreen has been allowed, either by settings or by user
1454 // clicking the allow button on the fullscreen infobar.
1455 bool tab_fullscreen_accepted_;
1456
1457 MouseLockState mouse_lock_state_;
1458 1411
1459 // True if the browser window has been shown at least once. 1412 // True if the browser window has been shown at least once.
1460 bool window_has_shown_; 1413 bool window_has_shown_;
1461 1414
1462 DISALLOW_COPY_AND_ASSIGN(Browser); 1415 DISALLOW_COPY_AND_ASSIGN(Browser);
1463 }; 1416 };
1464 1417
1465 #endif // CHROME_BROWSER_UI_BROWSER_H_ 1418 #endif // CHROME_BROWSER_UI_BROWSER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser.cc » ('j') | chrome/browser/ui/fullscreen_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698