| 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..0aca6c2ff5ddf8eadf743b5c1bf92290ca831b7b 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;
|
| @@ -50,10 +47,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(ExclusiveAccessControllerManager* manager,
|
| + Browser* browser);
|
| ~FullscreenController() override;
|
|
|
| // Browser/User Fullscreen ///////////////////////////////////////////////////
|
| @@ -63,6 +61,8 @@ class FullscreenController : public content::NotificationObserver {
|
| // transition.
|
| bool IsFullscreenForBrowser() const;
|
|
|
| + bool IsPrivilegedFullscreenForTab() const;
|
| +
|
| void ToggleBrowserFullscreenMode();
|
|
|
| // Fullscreen mode with tab strip and toolbar shown.
|
| @@ -81,6 +81,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.
|
| + 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 +118,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();
|
| + 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 +168,6 @@ class FullscreenController : public content::NotificationObserver {
|
| const;
|
| void UnlockMouse();
|
|
|
| - 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 +187,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_;
|
|
|