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_EXCLUSIVE_ACCESS_FULLSCREEN_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_CONTROLLER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // BrowserWindow::IsFullscreen() may still return false. | 81 // BrowserWindow::IsFullscreen() may still return false. |
82 bool IsWindowFullscreenForTabOrPending() const; | 82 bool IsWindowFullscreenForTabOrPending() const; |
83 | 83 |
84 // Returns true if the browser window is fullscreen because of extension | 84 // Returns true if the browser window is fullscreen because of extension |
85 // initiated fullscreen. | 85 // initiated fullscreen. |
86 bool IsExtensionFullscreenOrPending() const; | 86 bool IsExtensionFullscreenOrPending() const; |
87 | 87 |
88 // Returns true if controller has entered fullscreen mode. | 88 // Returns true if controller has entered fullscreen mode. |
89 bool IsControllerInitiatedFullscreen() const; | 89 bool IsControllerInitiatedFullscreen() const; |
90 | 90 |
91 // Returns true if the user has accepted fullscreen. | 91 // Returns true if the site has entered fullscreen. |
92 bool IsUserAcceptedFullscreen() const; | 92 bool IsTabFullscreen() const; |
93 | 93 |
94 // Returns true if the tab is/will be in fullscreen mode. Note: This does NOT | 94 // Returns true if the tab is/will be in fullscreen mode. Note: This does NOT |
95 // indicate whether the browser window is/will be fullscreened as well. See | 95 // indicate whether the browser window is/will be fullscreened as well. See |
96 // 'FullscreenWithinTab Note'. | 96 // 'FullscreenWithinTab Note'. |
97 bool IsFullscreenForTabOrPending( | 97 bool IsFullscreenForTabOrPending( |
98 const content::WebContents* web_contents) const; | 98 const content::WebContents* web_contents) const; |
99 | 99 |
100 // True if fullscreen was entered because of tab fullscreen (was not | 100 // True if fullscreen was entered because of tab fullscreen (was not |
101 // previously in user-initiated fullscreen). | 101 // previously in user-initiated fullscreen). |
102 bool IsFullscreenCausedByTab() const; | 102 bool IsFullscreenCausedByTab() const; |
(...skipping 13 matching lines...) Expand all Loading... |
116 void ExitFullscreenModeForTab(content::WebContents* web_contents); | 116 void ExitFullscreenModeForTab(content::WebContents* web_contents); |
117 | 117 |
118 // Platform Fullscreen /////////////////////////////////////////////////////// | 118 // Platform Fullscreen /////////////////////////////////////////////////////// |
119 | 119 |
120 // Overrde from ExclusiveAccessControllerBase. | 120 // Overrde from ExclusiveAccessControllerBase. |
121 void OnTabDetachedFromView(content::WebContents* web_contents) override; | 121 void OnTabDetachedFromView(content::WebContents* web_contents) override; |
122 void OnTabClosing(content::WebContents* web_contents) override; | 122 void OnTabClosing(content::WebContents* web_contents) override; |
123 bool HandleUserPressedEscape() override; | 123 bool HandleUserPressedEscape() override; |
124 | 124 |
125 void ExitExclusiveAccessToPreviousState() override; | 125 void ExitExclusiveAccessToPreviousState() override; |
126 bool OnAcceptExclusiveAccessPermission() override; | |
127 bool OnDenyExclusiveAccessPermission() override; | |
128 GURL GetURLForExclusiveAccessBubble() const override; | 126 GURL GetURLForExclusiveAccessBubble() const override; |
129 void ExitExclusiveAccessIfNecessary() override; | 127 void ExitExclusiveAccessIfNecessary() override; |
130 // Callbacks ///////////////////////////////////////////////////////////////// | 128 // Callbacks ///////////////////////////////////////////////////////////////// |
131 | 129 |
132 // Called by Browser::WindowFullscreenStateChanged. | 130 // Called by Browser::WindowFullscreenStateChanged. |
133 void WindowFullscreenStateChanged(); | 131 void WindowFullscreenStateChanged(); |
134 | 132 |
135 private: | 133 private: |
136 friend class FullscreenControllerTest; | 134 friend class FullscreenControllerTest; |
137 | 135 |
(...skipping 12 matching lines...) Expand all Loading... |
150 // necessary. | 148 // necessary. |
151 void NotifyTabExclusiveAccessLost() override; | 149 void NotifyTabExclusiveAccessLost() override; |
152 | 150 |
153 void RecordBubbleReshowsHistogram(int bubble_reshow_count) override; | 151 void RecordBubbleReshowsHistogram(int bubble_reshow_count) override; |
154 | 152 |
155 void ToggleFullscreenModeInternal(FullscreenInternalOption option); | 153 void ToggleFullscreenModeInternal(FullscreenInternalOption option); |
156 void EnterFullscreenModeInternal(FullscreenInternalOption option); | 154 void EnterFullscreenModeInternal(FullscreenInternalOption option); |
157 void ExitFullscreenModeInternal(); | 155 void ExitFullscreenModeInternal(); |
158 void SetFullscreenedTab(content::WebContents* tab, const GURL& origin); | 156 void SetFullscreenedTab(content::WebContents* tab, const GURL& origin); |
159 | 157 |
160 ContentSetting GetFullscreenSetting() const; | |
161 | |
162 void SetPrivilegedFullscreenForTesting(bool is_privileged); | 158 void SetPrivilegedFullscreenForTesting(bool is_privileged); |
163 // Returns true if |web_contents| was toggled into/out of fullscreen mode as a | 159 // Returns true if |web_contents| was toggled into/out of fullscreen mode as a |
164 // screen-captured tab. See 'FullscreenWithinTab Note'. | 160 // screen-captured tab. See 'FullscreenWithinTab Note'. |
165 bool MaybeToggleFullscreenForCapturedTab(content::WebContents* web_contents, | 161 bool MaybeToggleFullscreenForCapturedTab(content::WebContents* web_contents, |
166 bool enter_fullscreen); | 162 bool enter_fullscreen); |
167 // Returns true if |web_contents| is in fullscreen mode as a screen-captured | 163 // Returns true if |web_contents| is in fullscreen mode as a screen-captured |
168 // tab. See 'FullscreenWithinTab Note'. | 164 // tab. See 'FullscreenWithinTab Note'. |
169 bool IsFullscreenForCapturedTab(const content::WebContents* web_contents) | 165 bool IsFullscreenForCapturedTab(const content::WebContents* web_contents) |
170 const; | 166 const; |
171 | 167 |
(...skipping 11 matching lines...) Expand all Loading... |
183 | 179 |
184 enum PriorFullscreenState { | 180 enum PriorFullscreenState { |
185 STATE_INVALID, | 181 STATE_INVALID, |
186 STATE_NORMAL, | 182 STATE_NORMAL, |
187 STATE_BROWSER_FULLSCREEN_NO_TOOLBAR, | 183 STATE_BROWSER_FULLSCREEN_NO_TOOLBAR, |
188 STATE_BROWSER_FULLSCREEN_WITH_TOOLBAR, | 184 STATE_BROWSER_FULLSCREEN_WITH_TOOLBAR, |
189 }; | 185 }; |
190 // The state before entering tab fullscreen mode via webkitRequestFullScreen. | 186 // The state before entering tab fullscreen mode via webkitRequestFullScreen. |
191 // When not in tab fullscreen, it is STATE_INVALID. | 187 // When not in tab fullscreen, it is STATE_INVALID. |
192 PriorFullscreenState state_prior_to_tab_fullscreen_; | 188 PriorFullscreenState state_prior_to_tab_fullscreen_; |
193 // True if tab fullscreen has been allowed, either by settings or by user | 189 // True if the site has entered into fullscreen. |
194 // clicking the allow button on the fullscreen infobar. | 190 bool tab_fullscreen_; |
195 bool tab_fullscreen_accepted_; | |
196 | 191 |
197 // True if this controller has toggled into tab OR browser fullscreen. | 192 // True if this controller has toggled into tab OR browser fullscreen. |
198 bool toggled_into_fullscreen_; | 193 bool toggled_into_fullscreen_; |
199 | 194 |
200 // Used to verify that calls we expect to reenter by calling | 195 // Used to verify that calls we expect to reenter by calling |
201 // WindowFullscreenStateChanged do so. | 196 // WindowFullscreenStateChanged do so. |
202 bool reentrant_window_state_change_call_check_; | 197 bool reentrant_window_state_change_call_check_; |
203 | 198 |
204 // Used in testing to confirm proper behavior for specific, privileged | 199 // Used in testing to confirm proper behavior for specific, privileged |
205 // fullscreen cases. | 200 // fullscreen cases. |
206 bool is_privileged_fullscreen_for_testing_; | 201 bool is_privileged_fullscreen_for_testing_; |
207 | 202 |
208 base::WeakPtrFactory<FullscreenController> ptr_factory_; | 203 base::WeakPtrFactory<FullscreenController> ptr_factory_; |
209 | 204 |
210 DISALLOW_COPY_AND_ASSIGN(FullscreenController); | 205 DISALLOW_COPY_AND_ASSIGN(FullscreenController); |
211 }; | 206 }; |
212 | 207 |
213 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_CONTROLLER_H_ | 208 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_FULLSCREEN_CONTROLLER_H_ |
OLD | NEW |