| 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_FULLSCREEN_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Returns true if the tab is/will be in fullscreen mode. Note: This does NOT | 84 // Returns true if the tab is/will be in fullscreen mode. Note: This does NOT |
| 85 // indicate whether the browser window is/will be fullscreened as well. See | 85 // indicate whether the browser window is/will be fullscreened as well. See |
| 86 // 'FullscreenWithinTab Note'. | 86 // 'FullscreenWithinTab Note'. |
| 87 bool IsFullscreenForTabOrPending( | 87 bool IsFullscreenForTabOrPending( |
| 88 const content::WebContents* web_contents) const; | 88 const content::WebContents* web_contents) const; |
| 89 | 89 |
| 90 // True if fullscreen was entered because of tab fullscreen (was not | 90 // True if fullscreen was entered because of tab fullscreen (was not |
| 91 // previously in user-initiated fullscreen). | 91 // previously in user-initiated fullscreen). |
| 92 bool IsFullscreenCausedByTab() const; | 92 bool IsFullscreenCausedByTab() const; |
| 93 | 93 |
| 94 // Enter or leave tab-initiated fullscreen mode. FullscreenController will | 94 // Enter tab-initiated fullscreen mode. FullscreenController will decide |
| 95 // decide whether to also fullscreen the browser window. See | 95 // whether to also fullscreen the browser window. See 'FullscreenWithinTab |
| 96 // 'FullscreenWithinTab Note'. | 96 // Note'. |
| 97 void ToggleFullscreenModeForTab(content::WebContents* web_contents, | 97 // |web_contents| represents the tab that requests to be fullscreen. |
| 98 bool enter_fullscreen); | 98 // |origin| represents the origin of the requesting frame inside the |
| 99 // WebContents. If empty, then the |web_contents|'s latest committed URL |
| 100 // origin will be used. |
| 101 void EnterFullscreenModeForTab(content::WebContents* web_contents, |
| 102 const GURL& origin); |
| 103 |
| 104 // Leave a tab-initiated fullscreen mode. |
| 105 // |web_contents| represents the tab that requests to no longer be fullscreen. |
| 106 void ExitFullscreenModeForTab(content::WebContents* web_contents); |
| 99 | 107 |
| 100 // Platform Fullscreen /////////////////////////////////////////////////////// | 108 // Platform Fullscreen /////////////////////////////////////////////////////// |
| 101 | 109 |
| 102 // Returns whether we are currently in a Metro snap view. | 110 // Returns whether we are currently in a Metro snap view. |
| 103 bool IsInMetroSnapMode(); | 111 bool IsInMetroSnapMode(); |
| 104 | 112 |
| 105 #if defined(OS_WIN) | 113 #if defined(OS_WIN) |
| 106 // API that puts the window into a mode suitable for rendering when Chrome | 114 // API that puts the window into a mode suitable for rendering when Chrome |
| 107 // is rendered in a 20% screen-width Metro snap view on Windows 8. | 115 // is rendered in a 20% screen-width Metro snap view on Windows 8. |
| 108 void SetMetroSnapMode(bool enable); | 116 void SetMetroSnapMode(bool enable); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // Sends a NOTIFICATION_FULLSCREEN_CHANGED notification. | 187 // Sends a NOTIFICATION_FULLSCREEN_CHANGED notification. |
| 180 void NotifyFullscreenChange(bool is_fullscreen); | 188 void NotifyFullscreenChange(bool is_fullscreen); |
| 181 // Notifies the tab that it has been forced out of fullscreen and mouse lock | 189 // Notifies the tab that it has been forced out of fullscreen and mouse lock |
| 182 // mode if necessary. | 190 // mode if necessary. |
| 183 void NotifyTabOfExitIfNecessary(); | 191 void NotifyTabOfExitIfNecessary(); |
| 184 void NotifyMouseLockChange(); | 192 void NotifyMouseLockChange(); |
| 185 | 193 |
| 186 void ToggleFullscreenModeInternal(FullscreenInternalOption option); | 194 void ToggleFullscreenModeInternal(FullscreenInternalOption option); |
| 187 void EnterFullscreenModeInternal(FullscreenInternalOption option); | 195 void EnterFullscreenModeInternal(FullscreenInternalOption option); |
| 188 void ExitFullscreenModeInternal(); | 196 void ExitFullscreenModeInternal(); |
| 189 void SetFullscreenedTab(content::WebContents* tab); | 197 void SetFullscreenedTab(content::WebContents* tab, const GURL& origin); |
| 190 void SetMouseLockTab(content::WebContents* tab); | 198 void SetMouseLockTab(content::WebContents* tab); |
| 191 | 199 |
| 192 // Make the current tab exit fullscreen mode or mouse lock if it is in it. | 200 // Make the current tab exit fullscreen mode or mouse lock if it is in it. |
| 193 void ExitTabFullscreenOrMouseLockIfNecessary(); | 201 void ExitTabFullscreenOrMouseLockIfNecessary(); |
| 194 void UpdateFullscreenExitBubbleContent(); | 202 void UpdateFullscreenExitBubbleContent(); |
| 195 | 203 |
| 196 ContentSetting GetFullscreenSetting(const GURL& url) const; | 204 ContentSetting GetFullscreenSetting() const; |
| 197 ContentSetting GetMouseLockSetting(const GURL& url) const; | 205 ContentSetting GetMouseLockSetting(const GURL& url) const; |
| 198 | 206 |
| 199 bool IsPrivilegedFullscreenForTab() const; | 207 bool IsPrivilegedFullscreenForTab() const; |
| 200 void SetPrivilegedFullscreenForTesting(bool is_privileged); | 208 void SetPrivilegedFullscreenForTesting(bool is_privileged); |
| 201 // Returns true if |web_contents| was toggled into/out of fullscreen mode as a | 209 // Returns true if |web_contents| was toggled into/out of fullscreen mode as a |
| 202 // screen-captured tab. See 'FullscreenWithinTab Note'. | 210 // screen-captured tab. See 'FullscreenWithinTab Note'. |
| 203 bool MaybeToggleFullscreenForCapturedTab(content::WebContents* web_contents, | 211 bool MaybeToggleFullscreenForCapturedTab(content::WebContents* web_contents, |
| 204 bool enter_fullscreen); | 212 bool enter_fullscreen); |
| 205 // Returns true if |web_contents| is in fullscreen mode as a screen-captured | 213 // Returns true if |web_contents| is in fullscreen mode as a screen-captured |
| 206 // tab. See 'FullscreenWithinTab Note'. | 214 // tab. See 'FullscreenWithinTab Note'. |
| 207 bool IsFullscreenForCapturedTab(const content::WebContents* web_contents) | 215 bool IsFullscreenForCapturedTab(const content::WebContents* web_contents) |
| 208 const; | 216 const; |
| 209 void UnlockMouse(); | 217 void UnlockMouse(); |
| 210 | 218 |
| 219 // Helper methods that should be used in a TAB context. |
| 220 GURL GetRequestingOrigin() const; |
| 221 GURL GetEmbeddingOrigin() const; |
| 222 |
| 211 Browser* const browser_; | 223 Browser* const browser_; |
| 212 BrowserWindow* const window_; | 224 BrowserWindow* const window_; |
| 213 Profile* const profile_; | 225 Profile* const profile_; |
| 214 | 226 |
| 215 // If there is currently a tab in fullscreen mode (entered via | 227 // If there is currently a tab in fullscreen mode (entered via |
| 216 // webkitRequestFullScreen), this is its WebContents. | 228 // webkitRequestFullScreen), this is its WebContents. |
| 217 // Assign using SetFullscreenedTab(). | 229 // Assign using SetFullscreenedTab(). |
| 218 content::WebContents* fullscreened_tab_; | 230 content::WebContents* fullscreened_tab_; |
| 219 | 231 |
| 232 // If a tab is fullscreen, the |fullscreen_origin_| should be used as the |
| 233 // origin with regards to fullscreen. The |fullscreened_tab_| url should be |
| 234 // used as the embedder url. |
| 235 GURL fullscreened_origin_; |
| 236 |
| 220 // The URL of the extension which trigerred "browser fullscreen" mode. | 237 // The URL of the extension which trigerred "browser fullscreen" mode. |
| 221 GURL extension_caused_fullscreen_; | 238 GURL extension_caused_fullscreen_; |
| 222 | 239 |
| 223 enum PriorFullscreenState { | 240 enum PriorFullscreenState { |
| 224 STATE_INVALID, | 241 STATE_INVALID, |
| 225 STATE_NORMAL, | 242 STATE_NORMAL, |
| 226 STATE_BROWSER_FULLSCREEN_NO_TOOLBAR, | 243 STATE_BROWSER_FULLSCREEN_NO_TOOLBAR, |
| 227 STATE_BROWSER_FULLSCREEN_WITH_TOOLBAR, | 244 STATE_BROWSER_FULLSCREEN_WITH_TOOLBAR, |
| 228 }; | 245 }; |
| 229 // The state before entering tab fullscreen mode via webkitRequestFullScreen. | 246 // The state before entering tab fullscreen mode via webkitRequestFullScreen. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 251 // Used in testing to confirm proper behavior for specific, privileged | 268 // Used in testing to confirm proper behavior for specific, privileged |
| 252 // fullscreen cases. | 269 // fullscreen cases. |
| 253 bool is_privileged_fullscreen_for_testing_; | 270 bool is_privileged_fullscreen_for_testing_; |
| 254 | 271 |
| 255 base::WeakPtrFactory<FullscreenController> ptr_factory_; | 272 base::WeakPtrFactory<FullscreenController> ptr_factory_; |
| 256 | 273 |
| 257 DISALLOW_COPY_AND_ASSIGN(FullscreenController); | 274 DISALLOW_COPY_AND_ASSIGN(FullscreenController); |
| 258 }; | 275 }; |
| 259 | 276 |
| 260 #endif // CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_ | 277 #endif // CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_ |
| OLD | NEW |