Chromium Code Reviews| Index: chrome/browser/ui/exclusive_access/fullscreen_controller.h |
| diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.h b/chrome/browser/ui/exclusive_access/fullscreen_controller.h |
| index 955754ca80eff0109017f8268f1205c151998606..5538f3bfe86e5f2e288b7a843b14f1be6f0e2b38 100644 |
| --- a/chrome/browser/ui/exclusive_access/fullscreen_controller.h |
| +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.h |
| @@ -9,15 +9,12 @@ |
| #include "base/basictypes.h" |
| #include "base/memory/weak_ptr.h" |
| -#include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" |
| +#include "chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h" |
| #include "components/content_settings/core/common/content_settings.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| -class Browser; |
| -class BrowserWindow; |
| class GURL; |
| -class Profile; |
| namespace content { |
| class WebContents; |
| @@ -34,8 +31,7 @@ class WebContents; |
| // tab so it can stop rendering in its fullscreen mode. |
| // |
| // For Flash, FullscreenController will auto-accept all permission requests for |
| -// fullscreen and/or mouse lock, since the assumption is that the plugin handles |
| -// this for us. |
| +// fullscreen, since the assumption is that the plugin handles this for us. |
| // |
| // FullscreenWithinTab Note: |
| // All fullscreen widgets are displayed within the tab contents area, and |
| @@ -50,10 +46,11 @@ class WebContents; |
| // quality improvement since scaling and letterboxing steps can be skipped in |
| // the capture pipeline. |
| -// This class implements fullscreen and mouselock behaviour. |
| -class FullscreenController : public content::NotificationObserver { |
| +// This class implements fullscreen behaviour. |
| +class FullscreenController : public ExclusiveAccessControllerBase { |
| public: |
| - explicit FullscreenController(Browser* browser); |
| + explicit FullscreenController(ExclusiveAccessManager* manager, |
|
miu
2015/01/16 22:17:39
Don't need explicit keyword anymore.
Sriram
2015/01/21 01:38:57
Done.
|
| + Browser* browser); |
| ~FullscreenController() override; |
| // Browser/User Fullscreen /////////////////////////////////////////////////// |
| @@ -63,6 +60,8 @@ class FullscreenController : public content::NotificationObserver { |
| // transition. |
| bool IsFullscreenForBrowser() const; |
| + bool IsPrivilegedFullscreenForTab() const; |
|
miu
2015/01/16 22:17:39
Needs comment. Might be worth mentioning this is
Sriram
2015/01/21 01:38:57
Done.
|
| + |
| void ToggleBrowserFullscreenMode(); |
| // Fullscreen mode with tab strip and toolbar shown. |
| @@ -81,6 +80,16 @@ class FullscreenController : public content::NotificationObserver { |
| // BrowserWindow::IsFullscreen() may still return false. |
| bool IsWindowFullscreenForTabOrPending() const; |
| + // Returns true if the browser window is fullscreen because of extension |
| + // initiated fullscreen. |
| + bool IsExtensionFullscreenOrPending() const; |
| + |
| + // Returns true if controller has entered fullscrene mode. |
|
miu
2015/01/16 22:17:39
/fullscrene/fullscreen/
Sriram
2015/01/21 01:38:57
Done.
|
| + bool IsControllerInitiatedFullscreen() const; |
| + |
| + // Returns true if the user has accepted fullscreen. |
| + bool IsUserAcceptedFullscreen() const; |
| + |
| // Returns true if the tab is/will be in fullscreen mode. Note: This does NOT |
| // indicate whether the browser window is/will be fullscreened as well. See |
| // 'FullscreenWithinTab Note'. |
| @@ -108,95 +117,45 @@ class FullscreenController : public content::NotificationObserver { |
| void SetMetroSnapMode(bool enable); |
| #endif |
| - // Mouse Lock //////////////////////////////////////////////////////////////// |
| - |
| - bool IsMouseLockRequested() const; |
| - bool IsMouseLocked() const; |
| - |
| - void RequestToLockMouse(content::WebContents* web_contents, |
| - bool user_gesture, |
| - bool last_unlocked_by_target); |
| + // Overrde from ExclusiveAccessControllerBase. |
| + void OnTabDetachedFromView(content::WebContents* web_contents) override; |
| + void OnTabClosing(content::WebContents* web_contents) override; |
| + bool HandleUserPressedEscape() override; |
| + void ExitExclusiveAccessToPreviousState() override; |
| + bool OnAcceptExclusiveAccessPermission() override; |
| + bool OnDenyExclusiveAccessPermission() override; |
| + GURL GetURLForExclusiveAccessBubble() const override; |
| + void ExitExclusiveAccessIfNecessary() override; |
| // Callbacks ///////////////////////////////////////////////////////////////// |
| - // Called by Browser::TabDeactivated. |
| - void OnTabDeactivated(content::WebContents* web_contents); |
| - |
| - // Called by Browser::ActiveTabChanged. |
| - void OnTabDetachedFromView(content::WebContents* web_contents); |
| - |
| - // Called by Browser::TabClosingAt. |
| - void OnTabClosing(content::WebContents* web_contents); |
| - |
| // Called by Browser::WindowFullscreenStateChanged. |
| void WindowFullscreenStateChanged(); |
| - // Called by Browser::PreHandleKeyboardEvent. |
| - bool HandleUserPressedEscape(); |
| - |
| - // Called by platform FullscreenExitBubble. |
| - void ExitTabOrBrowserFullscreenToPreviousState(); |
| - void OnAcceptFullscreenPermission(); |
| - void OnDenyFullscreenPermission(); |
| - |
| - // Called by Browser::LostMouseLock. |
| - void LostMouseLock(); |
| - |
| - // content::NotificationObserver: |
| - void Observe(int type, |
| - const content::NotificationSource& source, |
| - const content::NotificationDetails& details) override; |
| - |
| - // Bubble Content //////////////////////////////////////////////////////////// |
| - |
| - GURL GetFullscreenExitBubbleURL() const; |
| - ExclusiveAccessBubbleType GetExclusiveAccessBubbleType() const; |
| - |
| private: |
| friend class FullscreenControllerTest; |
| - enum MouseLockState { |
| - MOUSELOCK_NOT_REQUESTED, |
| - // The page requests to lock the mouse and the user hasn't responded to the |
| - // request. |
| - MOUSELOCK_REQUESTED, |
| - // Mouse lock has been allowed by the user. |
| - MOUSELOCK_ACCEPTED, |
| - // Mouse lock has been silently accepted, no notification to user. |
| - MOUSELOCK_ACCEPTED_SILENTLY |
| - }; |
| - |
| enum FullscreenInternalOption { |
| BROWSER, |
| BROWSER_WITH_TOOLBAR, |
| TAB |
| }; |
| - void UpdateNotificationRegistrations(); |
| - |
| // Posts a task to call NotifyFullscreenChange. |
| void PostFullscreenChangeNotification(bool is_fullscreen); |
| // Sends a NOTIFICATION_FULLSCREEN_CHANGED notification. |
| void NotifyFullscreenChange(bool is_fullscreen); |
| - // Notifies the tab that it has been forced out of fullscreen and mouse lock |
| - // mode if necessary. |
| - void NotifyTabOfExitIfNecessary(); |
| - void NotifyMouseLockChange(); |
| + |
| + // Notifies the tab that it has been forced out of fullscreen mode if |
| + // necessary. |
| + void NotifyTabOfExclusiveAccessChange() override; |
| void ToggleFullscreenModeInternal(FullscreenInternalOption option); |
| void EnterFullscreenModeInternal(FullscreenInternalOption option); |
| void ExitFullscreenModeInternal(); |
| - void SetFullscreenedTab(content::WebContents* tab); |
| - void SetMouseLockTab(content::WebContents* tab); |
| - |
| - // Make the current tab exit fullscreen mode or mouse lock if it is in it. |
| - void ExitTabFullscreenOrMouseLockIfNecessary(); |
| - void UpdateFullscreenExitBubbleContent(); |
| ContentSetting GetFullscreenSetting(const GURL& url) const; |
| - ContentSetting GetMouseLockSetting(const GURL& url) const; |
| - bool IsPrivilegedFullscreenForTab() const; |
| void SetPrivilegedFullscreenForTesting(bool is_privileged); |
| // Returns true if |web_contents| was toggled into/out of fullscreen mode as a |
| // screen-captured tab. See 'FullscreenWithinTab Note'. |
| @@ -208,15 +167,6 @@ class FullscreenController : public content::NotificationObserver { |
| const; |
| void UnlockMouse(); |
|
miu
2015/01/16 22:17:39
Should UnlockMouse() be removed?
Sriram
2015/01/21 01:38:57
Done.
|
| - Browser* const browser_; |
| - BrowserWindow* const window_; |
| - Profile* const profile_; |
| - |
| - // If there is currently a tab in fullscreen mode (entered via |
| - // webkitRequestFullScreen), this is its WebContents. |
| - // Assign using SetFullscreenedTab(). |
| - content::WebContents* fullscreened_tab_; |
| - |
| // The URL of the extension which trigerred "browser fullscreen" mode. |
| GURL extension_caused_fullscreen_; |
| @@ -236,14 +186,6 @@ class FullscreenController : public content::NotificationObserver { |
| // True if this controller has toggled into tab OR browser fullscreen. |
| bool toggled_into_fullscreen_; |
| - // WebContents for current tab requesting or currently in mouse lock. |
| - // Assign using SetMouseLockTab(). |
| - content::WebContents* mouse_lock_tab_; |
| - |
| - MouseLockState mouse_lock_state_; |
| - |
| - content::NotificationRegistrar registrar_; |
| - |
| // Used to verify that calls we expect to reenter by calling |
| // WindowFullscreenStateChanged do so. |
| bool reentrant_window_state_change_call_check_; |