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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // whereas browser fullscreen mode doesn't. Therefore if a user forces an exit | 30 // whereas browser fullscreen mode doesn't. Therefore if a user forces an exit |
31 // from tab fullscreen, we need to notify the tab so it can stop rendering in | 31 // from tab fullscreen, we need to notify the tab so it can stop rendering in |
32 // its fullscreen mode. | 32 // its fullscreen mode. |
33 | 33 |
34 // This class implements fullscreen and mouselock behaviour. | 34 // This class implements fullscreen and mouselock behaviour. |
35 class FullscreenController : public base::RefCounted<FullscreenController> { | 35 class FullscreenController : public base::RefCounted<FullscreenController> { |
36 public: | 36 public: |
37 FullscreenController(BrowserWindow* window, | 37 FullscreenController(BrowserWindow* window, |
38 Profile* profile, | 38 Profile* profile, |
39 Browser* browser); | 39 Browser* browser); |
40 virtual ~FullscreenController(); | |
41 | 40 |
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. |
(...skipping 23 matching lines...) Expand all Loading... |
74 void OnTabDeactivated(TabContentsWrapper* contents); | 73 void OnTabDeactivated(TabContentsWrapper* contents); |
75 void OnAcceptFullscreenPermission(const GURL& url, | 74 void OnAcceptFullscreenPermission(const GURL& url, |
76 FullscreenExitBubbleType bubble_type); | 75 FullscreenExitBubbleType bubble_type); |
77 void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type); | 76 void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type); |
78 void WindowFullscreenStateChanged(); | 77 void WindowFullscreenStateChanged(); |
79 bool HandleUserPressedEscape(); | 78 bool HandleUserPressedEscape(); |
80 | 79 |
81 FullscreenExitBubbleType GetFullscreenExitBubbleType() const; | 80 FullscreenExitBubbleType GetFullscreenExitBubbleType() const; |
82 | 81 |
83 private: | 82 private: |
| 83 friend class base::RefCounted<FullscreenController>; |
| 84 |
84 enum MouseLockState { | 85 enum MouseLockState { |
85 MOUSELOCK_NOT_REQUESTED, | 86 MOUSELOCK_NOT_REQUESTED, |
86 // The page requests to lock the mouse and the user hasn't responded to the | 87 // The page requests to lock the mouse and the user hasn't responded to the |
87 // request. | 88 // request. |
88 MOUSELOCK_REQUESTED, | 89 MOUSELOCK_REQUESTED, |
89 // Mouse lock has been allowed by the user. | 90 // Mouse lock has been allowed by the user. |
90 MOUSELOCK_ACCEPTED | 91 MOUSELOCK_ACCEPTED |
91 }; | 92 }; |
92 | 93 |
| 94 virtual ~FullscreenController(); |
| 95 |
93 // Notifies the tab that it has been forced out of fullscreen mode if | 96 // Notifies the tab that it has been forced out of fullscreen mode if |
94 // necessary. | 97 // necessary. |
95 void NotifyTabOfFullscreenExitIfNecessary(); | 98 void NotifyTabOfFullscreenExitIfNecessary(); |
96 // Make the current tab exit fullscreen mode if it is in it. | 99 // Make the current tab exit fullscreen mode if it is in it. |
97 void ExitTabbedFullscreenModeIfNecessary(); | 100 void ExitTabbedFullscreenModeIfNecessary(); |
98 void UpdateFullscreenExitBubbleContent(); | 101 void UpdateFullscreenExitBubbleContent(); |
99 void NotifyFullscreenChange(); | 102 void NotifyFullscreenChange(); |
100 ContentSetting GetFullscreenSetting(const GURL& url) const; | 103 ContentSetting GetFullscreenSetting(const GURL& url) const; |
101 ContentSetting GetMouseLockSetting(const GURL& url) const; | 104 ContentSetting GetMouseLockSetting(const GURL& url) const; |
102 | 105 |
(...skipping 19 matching lines...) Expand all Loading... |
122 // True if tab fullscreen has been allowed, either by settings or by user | 125 // True if tab fullscreen has been allowed, either by settings or by user |
123 // clicking the allow button on the fullscreen infobar. | 126 // clicking the allow button on the fullscreen infobar. |
124 bool tab_fullscreen_accepted_; | 127 bool tab_fullscreen_accepted_; |
125 | 128 |
126 MouseLockState mouse_lock_state_; | 129 MouseLockState mouse_lock_state_; |
127 | 130 |
128 DISALLOW_COPY_AND_ASSIGN(FullscreenController); | 131 DISALLOW_COPY_AND_ASSIGN(FullscreenController); |
129 }; | 132 }; |
130 | 133 |
131 #endif // CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_ | 134 #endif // CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_ |
OLD | NEW |