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