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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 // Wrapper for the factory method in BrowserWindow. This allows subclasses to | 783 // Wrapper for the factory method in BrowserWindow. This allows subclasses to |
784 // set their own window. | 784 // set their own window. |
785 virtual BrowserWindow* CreateBrowserWindow(); | 785 virtual BrowserWindow* CreateBrowserWindow(); |
786 | 786 |
787 private: | 787 private: |
788 FRIEND_TEST_ALL_PREFIXES(AppModeTest, EnableAppModeTest); | 788 FRIEND_TEST_ALL_PREFIXES(AppModeTest, EnableAppModeTest); |
789 FRIEND_TEST_ALL_PREFIXES(BrowserTest, NoTabsInPopups); | 789 FRIEND_TEST_ALL_PREFIXES(BrowserTest, NoTabsInPopups); |
790 FRIEND_TEST_ALL_PREFIXES(BrowserTest, ConvertTabToAppShortcut); | 790 FRIEND_TEST_ALL_PREFIXES(BrowserTest, ConvertTabToAppShortcut); |
791 FRIEND_TEST_ALL_PREFIXES(BrowserTest, OpenAppWindowLikeNtp); | 791 FRIEND_TEST_ALL_PREFIXES(BrowserTest, OpenAppWindowLikeNtp); |
792 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch); | 792 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch); |
| 793 FRIEND_TEST_ALL_PREFIXES(BrowserTest, TestToggleFullscreenModeForTab); |
793 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutNoPref); | 794 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutNoPref); |
794 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutWindowPref); | 795 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutWindowPref); |
795 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutTabPref); | 796 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutTabPref); |
796 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutPanel); | 797 FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutPanel); |
797 | 798 |
798 // Used to describe why a tab is being detached. This is used by | 799 // Used to describe why a tab is being detached. This is used by |
799 // TabDetachedAtImpl. | 800 // TabDetachedAtImpl. |
800 enum DetachType { | 801 enum DetachType { |
801 // Result of TabDetachedAt. | 802 // Result of TabDetachedAt. |
802 DETACH_TYPE_DETACH, | 803 DETACH_TYPE_DETACH, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 const history::HistoryAddPageArgs& add_page_args, | 889 const history::HistoryAddPageArgs& add_page_args, |
889 NavigationType::Type navigation_type) OVERRIDE; | 890 NavigationType::Type navigation_type) OVERRIDE; |
890 virtual void ContentRestrictionsChanged(TabContents* source) OVERRIDE; | 891 virtual void ContentRestrictionsChanged(TabContents* source) OVERRIDE; |
891 virtual void RendererUnresponsive(TabContents* source) OVERRIDE; | 892 virtual void RendererUnresponsive(TabContents* source) OVERRIDE; |
892 virtual void RendererResponsive(TabContents* source) OVERRIDE; | 893 virtual void RendererResponsive(TabContents* source) OVERRIDE; |
893 virtual void WorkerCrashed(TabContents* source) OVERRIDE; | 894 virtual void WorkerCrashed(TabContents* source) OVERRIDE; |
894 virtual void DidNavigateMainFramePostCommit(TabContents* tab) OVERRIDE; | 895 virtual void DidNavigateMainFramePostCommit(TabContents* tab) OVERRIDE; |
895 virtual void DidNavigateToPendingEntry(TabContents* tab) OVERRIDE; | 896 virtual void DidNavigateToPendingEntry(TabContents* tab) OVERRIDE; |
896 virtual content::JavaScriptDialogCreator* | 897 virtual content::JavaScriptDialogCreator* |
897 GetJavaScriptDialogCreator() OVERRIDE; | 898 GetJavaScriptDialogCreator() OVERRIDE; |
| 899 virtual void ToggleFullscreenModeForTab(TabContents* tab, |
| 900 bool enter_fullscreen) OVERRIDE; |
898 | 901 |
899 // Overridden from TabContentsWrapperDelegate: | 902 // Overridden from TabContentsWrapperDelegate: |
900 virtual void OnDidGetApplicationInfo(TabContentsWrapper* source, | 903 virtual void OnDidGetApplicationInfo(TabContentsWrapper* source, |
901 int32 page_id) OVERRIDE; | 904 int32 page_id) OVERRIDE; |
902 virtual void OnInstallApplication( | 905 virtual void OnInstallApplication( |
903 TabContentsWrapper* source, | 906 TabContentsWrapper* source, |
904 const WebApplicationInfo& app_info) OVERRIDE; | 907 const WebApplicationInfo& app_info) OVERRIDE; |
905 | 908 |
906 // Note that the caller is responsible for deleting |old_tab_contents|. | 909 // Note that the caller is responsible for deleting |old_tab_contents|. |
907 virtual void SwapTabContents(TabContentsWrapper* old_tab_contents, | 910 virtual void SwapTabContents(TabContentsWrapper* old_tab_contents, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 // this to return NULL if called before the toolbar has initialized. | 1020 // this to return NULL if called before the toolbar has initialized. |
1018 // TODO(beng): remove this. | 1021 // TODO(beng): remove this. |
1019 StatusBubble* GetStatusBubble(); | 1022 StatusBubble* GetStatusBubble(); |
1020 | 1023 |
1021 // Session restore functions //////////////////////////////////////////////// | 1024 // Session restore functions //////////////////////////////////////////////// |
1022 | 1025 |
1023 // Notifies the history database of the index for all tabs whose index is | 1026 // Notifies the history database of the index for all tabs whose index is |
1024 // >= index. | 1027 // >= index. |
1025 void SyncHistoryWithTabs(int index); | 1028 void SyncHistoryWithTabs(int index); |
1026 | 1029 |
| 1030 // Tab fullscreen functions ///////////////////////////////////////////////// |
| 1031 |
| 1032 // There are two different kinds of fullscreen mode - "tab fullscreen" and |
| 1033 // "browser fullscreen". "Tab fullscreen" refers to when a tab enters |
| 1034 // fullscreen mode via the JS fullscreen API, and "browser fullscreen" |
| 1035 // refers to the user putting the browser itself into fullscreen mode from |
| 1036 // the UI. The difference is that tab fullscreen has implications for how |
| 1037 // the contents of the tab render (eg: a video element may grow to consume |
| 1038 // the whole tab), whereas browser fullscreen mode doesn't. Therefore if a |
| 1039 // user forces an exit from fullscreen, we need to notify the tab so it can |
| 1040 // stop rendering in its fullscreen mode. |
| 1041 |
| 1042 // Make the current tab exit fullscreen mode if it is in it. |
| 1043 void ExitTabbedFullscreenModeIfNecessary(); |
| 1044 |
| 1045 // Notifies the tab that it has been forced out of fullscreen mode if |
| 1046 // necessary. |
| 1047 void NotifyTabOfFullscreenExitIfNecessary(); |
| 1048 |
1027 // OnBeforeUnload handling ////////////////////////////////////////////////// | 1049 // OnBeforeUnload handling ////////////////////////////////////////////////// |
1028 | 1050 |
1029 typedef std::set<TabContents*> UnloadListenerSet; | 1051 typedef std::set<TabContents*> UnloadListenerSet; |
1030 | 1052 |
1031 // Processes the next tab that needs it's beforeunload/unload event fired. | 1053 // Processes the next tab that needs it's beforeunload/unload event fired. |
1032 void ProcessPendingTabs(); | 1054 void ProcessPendingTabs(); |
1033 | 1055 |
1034 // Whether we've completed firing all the tabs' beforeunload/unload events. | 1056 // Whether we've completed firing all the tabs' beforeunload/unload events. |
1035 bool HasCompletedUnloadProcessing() const; | 1057 bool HasCompletedUnloadProcessing() const; |
1036 | 1058 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 // restrictions active. | 1162 // restrictions active. |
1141 int GetContentRestrictionsForSelectedTab(); | 1163 int GetContentRestrictionsForSelectedTab(); |
1142 | 1164 |
1143 // Resets |bookmark_bar_state_| based on the active tab. Notifies the | 1165 // Resets |bookmark_bar_state_| based on the active tab. Notifies the |
1144 // BrowserWindow if necessary. | 1166 // BrowserWindow if necessary. |
1145 void UpdateBookmarkBarState(BookmarkBarStateChangeReason reason); | 1167 void UpdateBookmarkBarState(BookmarkBarStateChangeReason reason); |
1146 | 1168 |
1147 // Open the bookmark manager with a defined hash action. | 1169 // Open the bookmark manager with a defined hash action. |
1148 void OpenBookmarkManagerWithHash(const std::string& action, int64 node_id); | 1170 void OpenBookmarkManagerWithHash(const std::string& action, int64 node_id); |
1149 | 1171 |
| 1172 // Make the current tab exit fullscreen mode. If the browser was fullscreen |
| 1173 // because of that (as opposed to the user clicking the fullscreen button) |
| 1174 // then take the browser out of fullscreen mode as well. |
| 1175 void ExitTabbedFullscreenMode(); |
| 1176 |
| 1177 // Notifies the tab that it has been forced out of fullscreen mode. |
| 1178 void NotifyTabOfFullscreenExit(); |
| 1179 |
1150 // Data members ///////////////////////////////////////////////////////////// | 1180 // Data members ///////////////////////////////////////////////////////////// |
1151 | 1181 |
1152 NotificationRegistrar registrar_; | 1182 NotificationRegistrar registrar_; |
1153 | 1183 |
1154 PrefChangeRegistrar profile_pref_registrar_; | 1184 PrefChangeRegistrar profile_pref_registrar_; |
1155 | 1185 |
1156 PrefChangeRegistrar local_pref_registrar_; | 1186 PrefChangeRegistrar local_pref_registrar_; |
1157 | 1187 |
1158 // This Browser's type. | 1188 // This Browser's type. |
1159 const Type type_; | 1189 const Type type_; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; | 1312 scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; |
1283 | 1313 |
1284 // Helper which implements the SyncedWindowDelegate interface. | 1314 // Helper which implements the SyncedWindowDelegate interface. |
1285 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; | 1315 scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; |
1286 | 1316 |
1287 scoped_ptr<InstantController> instant_; | 1317 scoped_ptr<InstantController> instant_; |
1288 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; | 1318 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; |
1289 | 1319 |
1290 BookmarkBar::State bookmark_bar_state_; | 1320 BookmarkBar::State bookmark_bar_state_; |
1291 | 1321 |
| 1322 // Tab to notify when the browser exits fullscreen mode. |
| 1323 TabContentsWrapper* fullscreened_tab_; |
| 1324 |
| 1325 // True if the current tab is in fullscreen mode. |
| 1326 bool tab_caused_fullscreen_; |
| 1327 |
1292 DISALLOW_COPY_AND_ASSIGN(Browser); | 1328 DISALLOW_COPY_AND_ASSIGN(Browser); |
1293 }; | 1329 }; |
1294 | 1330 |
1295 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1331 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
OLD | NEW |