OLD | NEW |
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 void ShowSingletonTabOverwritingNTP(const browser::NavigateParams& params); | 459 void ShowSingletonTabOverwritingNTP(const browser::NavigateParams& params); |
460 | 460 |
461 // Creates a NavigateParams struct for a singleton tab navigation. | 461 // Creates a NavigateParams struct for a singleton tab navigation. |
462 browser::NavigateParams GetSingletonTabNavigateParams(const GURL& url); | 462 browser::NavigateParams GetSingletonTabNavigateParams(const GURL& url); |
463 | 463 |
464 // Invoked when the fullscreen state of the window changes. | 464 // Invoked when the fullscreen state of the window changes. |
465 // BrowserWindow::SetFullscreen invokes this after the window has become | 465 // BrowserWindow::SetFullscreen invokes this after the window has become |
466 // fullscreen. | 466 // fullscreen. |
467 void WindowFullscreenStateChanged(); | 467 void WindowFullscreenStateChanged(); |
468 | 468 |
| 469 // Sends a notification that the fullscreen state has changed. |
| 470 void NotifyFullscreenChange(); |
| 471 |
469 // Assorted browser commands //////////////////////////////////////////////// | 472 // Assorted browser commands //////////////////////////////////////////////// |
470 | 473 |
471 // NOTE: Within each of the following sections, the IDs are ordered roughly by | 474 // NOTE: Within each of the following sections, the IDs are ordered roughly by |
472 // how they appear in the GUI/menus (left to right, top to bottom, etc.). | 475 // how they appear in the GUI/menus (left to right, top to bottom, etc.). |
473 | 476 |
474 // Navigation commands | 477 // Navigation commands |
475 bool CanGoBack() const; | 478 bool CanGoBack() const; |
476 void GoBack(WindowOpenDisposition disposition); | 479 void GoBack(WindowOpenDisposition disposition); |
477 bool CanGoForward() const; | 480 bool CanGoForward() const; |
478 void GoForward(WindowOpenDisposition disposition); | 481 void GoForward(WindowOpenDisposition disposition); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 // Wrapper for the factory method in BrowserWindow. This allows subclasses to | 788 // Wrapper for the factory method in BrowserWindow. This allows subclasses to |
786 // set their own window. | 789 // set their own window. |
787 virtual BrowserWindow* CreateBrowserWindow(); | 790 virtual BrowserWindow* CreateBrowserWindow(); |
788 | 791 |
789 private: | 792 private: |
790 FRIEND_TEST_ALL_PREFIXES(AppModeTest, EnableAppModeTest); | 793 FRIEND_TEST_ALL_PREFIXES(AppModeTest, EnableAppModeTest); |
791 FRIEND_TEST_ALL_PREFIXES(BrowserTest, NoTabsInPopups); | 794 FRIEND_TEST_ALL_PREFIXES(BrowserTest, NoTabsInPopups); |
792 FRIEND_TEST_ALL_PREFIXES(BrowserTest, ConvertTabToAppShortcut); | 795 FRIEND_TEST_ALL_PREFIXES(BrowserTest, ConvertTabToAppShortcut); |
793 FRIEND_TEST_ALL_PREFIXES(BrowserTest, OpenAppWindowLikeNtp); | 796 FRIEND_TEST_ALL_PREFIXES(BrowserTest, OpenAppWindowLikeNtp); |
794 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch); | 797 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch); |
| 798 FRIEND_TEST_ALL_PREFIXES(BrowserTest, TestNewTabExitsFullscreen); |
| 799 FRIEND_TEST_ALL_PREFIXES(BrowserTest, TestTabExitsItselfFromFullscreen); |
795 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutNoPref); | 800 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutNoPref); |
796 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutWindowPref); | 801 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutWindowPref); |
797 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutTabPref); | 802 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutTabPref); |
798 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutPanel); | 803 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutPanel); |
799 | 804 |
800 // Used to describe why a tab is being detached. This is used by | 805 // Used to describe why a tab is being detached. This is used by |
801 // TabDetachedAtImpl. | 806 // TabDetachedAtImpl. |
802 enum DetachType { | 807 enum DetachType { |
803 // Result of TabDetachedAt. | 808 // Result of TabDetachedAt. |
804 DETACH_TYPE_DETACH, | 809 DETACH_TYPE_DETACH, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 virtual void WorkerCrashed(TabContents* source) OVERRIDE; | 900 virtual void WorkerCrashed(TabContents* source) OVERRIDE; |
896 virtual void DidNavigateMainFramePostCommit(TabContents* tab) OVERRIDE; | 901 virtual void DidNavigateMainFramePostCommit(TabContents* tab) OVERRIDE; |
897 virtual void DidNavigateToPendingEntry(TabContents* tab) OVERRIDE; | 902 virtual void DidNavigateToPendingEntry(TabContents* tab) OVERRIDE; |
898 virtual content::JavaScriptDialogCreator* | 903 virtual content::JavaScriptDialogCreator* |
899 GetJavaScriptDialogCreator() OVERRIDE; | 904 GetJavaScriptDialogCreator() OVERRIDE; |
900 virtual void RunFileChooser( | 905 virtual void RunFileChooser( |
901 TabContents* tab, | 906 TabContents* tab, |
902 const ViewHostMsg_RunFileChooser_Params& params) OVERRIDE; | 907 const ViewHostMsg_RunFileChooser_Params& params) OVERRIDE; |
903 virtual void EnumerateDirectory(TabContents* tab, int request_id, | 908 virtual void EnumerateDirectory(TabContents* tab, int request_id, |
904 const FilePath& path) OVERRIDE; | 909 const FilePath& path) OVERRIDE; |
905 | 910 virtual void ToggleFullscreenModeForTab(TabContents* tab, |
| 911 bool enter_fullscreen) OVERRIDE; |
906 | 912 |
907 // Overridden from TabContentsWrapperDelegate: | 913 // Overridden from TabContentsWrapperDelegate: |
908 virtual void OnDidGetApplicationInfo(TabContentsWrapper* source, | 914 virtual void OnDidGetApplicationInfo(TabContentsWrapper* source, |
909 int32 page_id) OVERRIDE; | 915 int32 page_id) OVERRIDE; |
910 virtual void OnInstallApplication( | 916 virtual void OnInstallApplication( |
911 TabContentsWrapper* source, | 917 TabContentsWrapper* source, |
912 const WebApplicationInfo& app_info) OVERRIDE; | 918 const WebApplicationInfo& app_info) OVERRIDE; |
913 | 919 |
914 // Note that the caller is responsible for deleting |old_tab_contents|. | 920 // Note that the caller is responsible for deleting |old_tab_contents|. |
915 virtual void SwapTabContents(TabContentsWrapper* old_tab_contents, | 921 virtual void SwapTabContents(TabContentsWrapper* old_tab_contents, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 // this to return NULL if called before the toolbar has initialized. | 1031 // this to return NULL if called before the toolbar has initialized. |
1026 // TODO(beng): remove this. | 1032 // TODO(beng): remove this. |
1027 StatusBubble* GetStatusBubble(); | 1033 StatusBubble* GetStatusBubble(); |
1028 | 1034 |
1029 // Session restore functions //////////////////////////////////////////////// | 1035 // Session restore functions //////////////////////////////////////////////// |
1030 | 1036 |
1031 // Notifies the history database of the index for all tabs whose index is | 1037 // Notifies the history database of the index for all tabs whose index is |
1032 // >= index. | 1038 // >= index. |
1033 void SyncHistoryWithTabs(int index); | 1039 void SyncHistoryWithTabs(int index); |
1034 | 1040 |
| 1041 // Tab fullscreen functions ///////////////////////////////////////////////// |
| 1042 |
| 1043 // There are two different kinds of fullscreen mode - "tab fullscreen" and |
| 1044 // "browser fullscreen". "Tab fullscreen" refers to when a tab enters |
| 1045 // fullscreen mode via the JS fullscreen API, and "browser fullscreen" |
| 1046 // refers to the user putting the browser itself into fullscreen mode from |
| 1047 // the UI. The difference is that tab fullscreen has implications for how |
| 1048 // the contents of the tab render (eg: a video element may grow to consume |
| 1049 // the whole tab), whereas browser fullscreen mode doesn't. Therefore if a |
| 1050 // user forces an exit from fullscreen, we need to notify the tab so it can |
| 1051 // stop rendering in its fullscreen mode. |
| 1052 |
| 1053 // Make the current tab exit fullscreen mode if it is in it. |
| 1054 void ExitTabbedFullscreenModeIfNecessary(); |
| 1055 |
| 1056 // Notifies the tab that it has been forced out of fullscreen mode if |
| 1057 // necessary. |
| 1058 void NotifyTabOfFullscreenExitIfNecessary(); |
| 1059 |
1035 // OnBeforeUnload handling ////////////////////////////////////////////////// | 1060 // OnBeforeUnload handling ////////////////////////////////////////////////// |
1036 | 1061 |
1037 typedef std::set<TabContents*> UnloadListenerSet; | 1062 typedef std::set<TabContents*> UnloadListenerSet; |
1038 | 1063 |
1039 // Processes the next tab that needs it's beforeunload/unload event fired. | 1064 // Processes the next tab that needs it's beforeunload/unload event fired. |
1040 void ProcessPendingTabs(); | 1065 void ProcessPendingTabs(); |
1041 | 1066 |
1042 // Whether we've completed firing all the tabs' beforeunload/unload events. | 1067 // Whether we've completed firing all the tabs' beforeunload/unload events. |
1043 bool HasCompletedUnloadProcessing() const; | 1068 bool HasCompletedUnloadProcessing() const; |
1044 | 1069 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 // restrictions active. | 1173 // restrictions active. |
1149 int GetContentRestrictionsForSelectedTab(); | 1174 int GetContentRestrictionsForSelectedTab(); |
1150 | 1175 |
1151 // Resets |bookmark_bar_state_| based on the active tab. Notifies the | 1176 // Resets |bookmark_bar_state_| based on the active tab. Notifies the |
1152 // BrowserWindow if necessary. | 1177 // BrowserWindow if necessary. |
1153 void UpdateBookmarkBarState(BookmarkBarStateChangeReason reason); | 1178 void UpdateBookmarkBarState(BookmarkBarStateChangeReason reason); |
1154 | 1179 |
1155 // Open the bookmark manager with a defined hash action. | 1180 // Open the bookmark manager with a defined hash action. |
1156 void OpenBookmarkManagerWithHash(const std::string& action, int64 node_id); | 1181 void OpenBookmarkManagerWithHash(const std::string& action, int64 node_id); |
1157 | 1182 |
| 1183 // Make the current tab exit fullscreen mode. If the browser was fullscreen |
| 1184 // because of that (as opposed to the user clicking the fullscreen button) |
| 1185 // then take the browser out of fullscreen mode as well. |
| 1186 void ExitTabbedFullscreenMode(); |
| 1187 |
| 1188 // Notifies the tab that it has been forced out of fullscreen mode. |
| 1189 void NotifyTabOfFullscreenExit(); |
| 1190 |
1158 // Data members ///////////////////////////////////////////////////////////// | 1191 // Data members ///////////////////////////////////////////////////////////// |
1159 | 1192 |
1160 NotificationRegistrar registrar_; | 1193 NotificationRegistrar registrar_; |
1161 | 1194 |
1162 PrefChangeRegistrar profile_pref_registrar_; | 1195 PrefChangeRegistrar profile_pref_registrar_; |
1163 | 1196 |
1164 PrefChangeRegistrar local_pref_registrar_; | 1197 PrefChangeRegistrar local_pref_registrar_; |
1165 | 1198 |
1166 // This Browser's type. | 1199 // This Browser's type. |
1167 const Type type_; | 1200 const Type type_; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; | 1324 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; |
1292 | 1325 |
1293 // Helper which implements the SyncedWindowDelegate interface. | 1326 // Helper which implements the SyncedWindowDelegate interface. |
1294 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; | 1327 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; |
1295 | 1328 |
1296 scoped_ptr<InstantController> instant_; | 1329 scoped_ptr<InstantController> instant_; |
1297 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; | 1330 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; |
1298 | 1331 |
1299 BookmarkBar::State bookmark_bar_state_; | 1332 BookmarkBar::State bookmark_bar_state_; |
1300 | 1333 |
| 1334 // Tab to notify when the browser exits fullscreen mode. |
| 1335 TabContentsWrapper* fullscreened_tab_; |
| 1336 |
| 1337 // True if the current tab is in fullscreen mode. |
| 1338 bool tab_caused_fullscreen_; |
| 1339 |
1301 DISALLOW_COPY_AND_ASSIGN(Browser); | 1340 DISALLOW_COPY_AND_ASSIGN(Browser); |
1302 }; | 1341 }; |
1303 | 1342 |
1304 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1343 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
OLD | NEW |