| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FULLSCREEN_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/ui/fullscreen_exit_bubble_type.h" | 11 #include "chrome/browser/ui/fullscreen_exit_bubble_type.h" |
| 12 #include "chrome/common/content_settings.h" | 12 #include "chrome/common/content_settings.h" |
| 13 | 13 |
| 14 class Browser; | 14 class Browser; |
| 15 class BrowserWindow; | 15 class BrowserWindow; |
| 16 class GURL; | 16 class GURL; |
| 17 class Profile; | 17 class Profile; |
| 18 class TabContents; | 18 class TabContents; |
| 19 typedef TabContents TabContentsWrapper; | |
| 20 | 19 |
| 21 namespace content { | 20 namespace content { |
| 22 class WebContents; | 21 class WebContents; |
| 23 } | 22 } |
| 24 | 23 |
| 25 // There are two different kinds of fullscreen mode - "tab fullscreen" and | 24 // There are two different kinds of fullscreen mode - "tab fullscreen" and |
| 26 // "browser fullscreen". "Tab fullscreen" refers to when a tab enters | 25 // "browser fullscreen". "Tab fullscreen" refers to when a tab enters |
| 27 // fullscreen mode via the JS fullscreen API, and "browser fullscreen" refers | 26 // fullscreen mode via the JS fullscreen API, and "browser fullscreen" refers |
| 28 // to the user putting the browser itself into fullscreen mode from the UI. The | 27 // to the user putting the browser itself into fullscreen mode from the UI. The |
| 29 // difference is that tab fullscreen has implications for how the contents of | 28 // difference is that tab fullscreen has implications for how the contents of |
| (...skipping 12 matching lines...) Expand all Loading... |
| 42 // Querying. | 41 // Querying. |
| 43 | 42 |
| 44 // Returns true if the window is currently fullscreen and was initially | 43 // Returns true if the window is currently fullscreen and was initially |
| 45 // transitioned to fullscreen by a browser (vs tab) mode transition. | 44 // transitioned to fullscreen by a browser (vs tab) mode transition. |
| 46 bool IsFullscreenForBrowser() const; | 45 bool IsFullscreenForBrowser() const; |
| 47 | 46 |
| 48 // Returns true if fullscreen has been caused by a tab. | 47 // Returns true if fullscreen has been caused by a tab. |
| 49 // The window may still be transitioning, and window_->IsFullscreen() | 48 // The window may still be transitioning, and window_->IsFullscreen() |
| 50 // may still return false. | 49 // may still return false. |
| 51 bool IsFullscreenForTabOrPending() const; | 50 bool IsFullscreenForTabOrPending() const; |
| 52 bool IsFullscreenForTabOrPending(const content::WebContents* tab) const; | 51 bool IsFullscreenForTabOrPending( |
| 52 const content::WebContents* web_contents) const; |
| 53 | 53 |
| 54 bool IsMouseLockRequested() const; | 54 bool IsMouseLockRequested() const; |
| 55 bool IsMouseLocked() const; | 55 bool IsMouseLocked() const; |
| 56 | 56 |
| 57 // Requests. | 57 // Requests. |
| 58 void RequestToLockMouse(content::WebContents* tab, | 58 void RequestToLockMouse(content::WebContents* web_contents, |
| 59 bool user_gesture, | 59 bool user_gesture, |
| 60 bool last_unlocked_by_target); | 60 bool last_unlocked_by_target); |
| 61 void ToggleFullscreenModeForTab(content::WebContents* tab, | 61 void ToggleFullscreenModeForTab(content::WebContents* web_contents, |
| 62 bool enter_fullscreen); | 62 bool enter_fullscreen); |
| 63 #if defined(OS_MACOSX) | 63 #if defined(OS_MACOSX) |
| 64 void TogglePresentationMode(); | 64 void TogglePresentationMode(); |
| 65 #endif | 65 #endif |
| 66 void ToggleFullscreenMode(); | 66 void ToggleFullscreenMode(); |
| 67 // Extension API implementation uses this method to toggle fullscreen mode. | 67 // Extension API implementation uses this method to toggle fullscreen mode. |
| 68 // The extension's name is displayed in the full screen bubble UI to attribute | 68 // The extension's name is displayed in the full screen bubble UI to attribute |
| 69 // the cause of the full screen state change. | 69 // the cause of the full screen state change. |
| 70 void ToggleFullscreenModeWithExtension(const GURL& extension_url); | 70 void ToggleFullscreenModeWithExtension(const GURL& extension_url); |
| 71 | 71 |
| 72 // Notifications. | 72 // Notifications. |
| 73 void LostMouseLock(); | 73 void LostMouseLock(); |
| 74 void OnTabClosing(content::WebContents* web_contents); | 74 void OnTabClosing(content::WebContents* web_contents); |
| 75 void OnTabDeactivated(TabContentsWrapper* contents); | 75 void OnTabDeactivated(TabContents* contents); |
| 76 void OnAcceptFullscreenPermission(const GURL& url, | 76 void OnAcceptFullscreenPermission(const GURL& url, |
| 77 FullscreenExitBubbleType bubble_type); | 77 FullscreenExitBubbleType bubble_type); |
| 78 void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type); | 78 void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type); |
| 79 void WindowFullscreenStateChanged(); | 79 void WindowFullscreenStateChanged(); |
| 80 bool HandleUserPressedEscape(); | 80 bool HandleUserPressedEscape(); |
| 81 | 81 |
| 82 FullscreenExitBubbleType GetFullscreenExitBubbleType() const; | 82 FullscreenExitBubbleType GetFullscreenExitBubbleType() const; |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 friend class base::RefCounted<FullscreenController>; | 85 friend class base::RefCounted<FullscreenController>; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 113 void TogglePresentationModeInternal(bool for_tab); | 113 void TogglePresentationModeInternal(bool for_tab); |
| 114 #endif | 114 #endif |
| 115 // TODO(koz): Change |for_tab| to an enum. | 115 // TODO(koz): Change |for_tab| to an enum. |
| 116 void ToggleFullscreenModeInternal(bool for_tab); | 116 void ToggleFullscreenModeInternal(bool for_tab); |
| 117 | 117 |
| 118 BrowserWindow* window_; | 118 BrowserWindow* window_; |
| 119 Profile* profile_; | 119 Profile* profile_; |
| 120 Browser* browser_; | 120 Browser* browser_; |
| 121 | 121 |
| 122 // If there is currently a tab in fullscreen mode (entered via | 122 // If there is currently a tab in fullscreen mode (entered via |
| 123 // webkitRequestFullScreen), this is its wrapper. | 123 // webkitRequestFullScreen), this is its TabContents. |
| 124 TabContentsWrapper* fullscreened_tab_; | 124 TabContents* fullscreened_tab_; |
| 125 | 125 |
| 126 // The URL of the extension which trigerred "browser fullscreen" mode. | 126 // The URL of the extension which trigerred "browser fullscreen" mode. |
| 127 GURL extension_caused_fullscreen_; | 127 GURL extension_caused_fullscreen_; |
| 128 | 128 |
| 129 // True if the current tab entered fullscreen mode via webkitRequestFullScreen | 129 // True if the current tab entered fullscreen mode via webkitRequestFullScreen |
| 130 bool tab_caused_fullscreen_; | 130 bool tab_caused_fullscreen_; |
| 131 // True if tab fullscreen has been allowed, either by settings or by user | 131 // True if tab fullscreen has been allowed, either by settings or by user |
| 132 // clicking the allow button on the fullscreen infobar. | 132 // clicking the allow button on the fullscreen infobar. |
| 133 bool tab_fullscreen_accepted_; | 133 bool tab_fullscreen_accepted_; |
| 134 | 134 |
| 135 // True if this controller has toggled into tab OR browser fullscreen. | 135 // True if this controller has toggled into tab OR browser fullscreen. |
| 136 bool toggled_into_fullscreen_; | 136 bool toggled_into_fullscreen_; |
| 137 | 137 |
| 138 // Wrapper for current tab requesting or currently in mouse lock. | 138 // TabContents for current tab requesting or currently in mouse lock. |
| 139 TabContentsWrapper* mouse_lock_tab_; | 139 TabContents* mouse_lock_tab_; |
| 140 | 140 |
| 141 MouseLockState mouse_lock_state_; | 141 MouseLockState mouse_lock_state_; |
| 142 | 142 |
| 143 DISALLOW_COPY_AND_ASSIGN(FullscreenController); | 143 DISALLOW_COPY_AND_ASSIGN(FullscreenController); |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 #endif // CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_ | 146 #endif // CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_ |
| OLD | NEW |