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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" | 10 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" |
11 #include "chrome/common/content_settings.h" | 11 #include "chrome/common/content_settings.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 | 14 |
15 class Browser; | 15 class Browser; |
16 class BrowserWindow; | 16 class BrowserWindow; |
17 class GURL; | 17 class GURL; |
18 class Profile; | 18 class Profile; |
19 class TabContents; | |
20 | 19 |
21 namespace content { | 20 namespace content { |
22 class WebContents; | 21 class WebContents; |
23 } | 22 } |
24 | 23 |
25 // There are two different kinds of fullscreen mode - "tab fullscreen" and | 24 // There are two different kinds of fullscreen mode - "tab fullscreen" and |
26 // "browser fullscreen". "Tab fullscreen" refers to when a tab enters | 25 // "browser fullscreen". "Tab fullscreen" refers to when a tab enters |
27 // fullscreen mode via the JS fullscreen API, and "browser fullscreen" refers | 26 // fullscreen mode via the JS fullscreen API, and "browser fullscreen" refers |
28 // to the user putting the browser itself into fullscreen mode from the UI. The | 27 // to the user putting the browser itself into fullscreen mode from the UI. The |
29 // difference is that tab fullscreen has implications for how the contents of | 28 // difference is that tab fullscreen has implications for how the contents of |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Notifies the tab that it has been forced out of fullscreen and mouse lock | 136 // Notifies the tab that it has been forced out of fullscreen and mouse lock |
138 // mode if necessary. | 137 // mode if necessary. |
139 void NotifyTabOfExitIfNecessary(); | 138 void NotifyTabOfExitIfNecessary(); |
140 void NotifyMouseLockChange(); | 139 void NotifyMouseLockChange(); |
141 | 140 |
142 // TODO(koz): Change |for_tab| to an enum. | 141 // TODO(koz): Change |for_tab| to an enum. |
143 void ToggleFullscreenModeInternal(bool for_tab); | 142 void ToggleFullscreenModeInternal(bool for_tab); |
144 #if defined(OS_MACOSX) | 143 #if defined(OS_MACOSX) |
145 void TogglePresentationModeInternal(bool for_tab); | 144 void TogglePresentationModeInternal(bool for_tab); |
146 #endif | 145 #endif |
147 void SetFullscreenedTab(TabContents* tab); | 146 void SetFullscreenedTab(content::WebContents* tab); |
148 void SetMouseLockTab(TabContents* tab); | 147 void SetMouseLockTab(content::WebContents* tab); |
149 | 148 |
150 // Make the current tab exit fullscreen mode or mouse lock if it is in it. | 149 // Make the current tab exit fullscreen mode or mouse lock if it is in it. |
151 void ExitTabFullscreenOrMouseLockIfNecessary(); | 150 void ExitTabFullscreenOrMouseLockIfNecessary(); |
152 void UpdateFullscreenExitBubbleContent(); | 151 void UpdateFullscreenExitBubbleContent(); |
153 | 152 |
154 ContentSetting GetFullscreenSetting(const GURL& url) const; | 153 ContentSetting GetFullscreenSetting(const GURL& url) const; |
155 ContentSetting GetMouseLockSetting(const GURL& url) const; | 154 ContentSetting GetMouseLockSetting(const GURL& url) const; |
156 | 155 |
157 base::WeakPtrFactory<FullscreenController> ptr_factory_; | 156 base::WeakPtrFactory<FullscreenController> ptr_factory_; |
158 | 157 |
159 Browser* browser_; | 158 Browser* browser_; |
160 BrowserWindow* window_; | 159 BrowserWindow* window_; |
161 Profile* profile_; | 160 Profile* profile_; |
162 | 161 |
163 // If there is currently a tab in fullscreen mode (entered via | 162 // If there is currently a tab in fullscreen mode (entered via |
164 // webkitRequestFullScreen), this is its TabContents. | 163 // webkitRequestFullScreen), this is its WebContents. |
165 // Assign using SetFullscreenedTab(). | 164 // Assign using SetFullscreenedTab(). |
166 TabContents* fullscreened_tab_; | 165 content::WebContents* fullscreened_tab_; |
167 | 166 |
168 // The URL of the extension which trigerred "browser fullscreen" mode. | 167 // The URL of the extension which trigerred "browser fullscreen" mode. |
169 GURL extension_caused_fullscreen_; | 168 GURL extension_caused_fullscreen_; |
170 | 169 |
171 // True if the current tab entered fullscreen mode via webkitRequestFullScreen | 170 // True if the current tab entered fullscreen mode via webkitRequestFullScreen |
172 bool tab_caused_fullscreen_; | 171 bool tab_caused_fullscreen_; |
173 // True if tab fullscreen has been allowed, either by settings or by user | 172 // True if tab fullscreen has been allowed, either by settings or by user |
174 // clicking the allow button on the fullscreen infobar. | 173 // clicking the allow button on the fullscreen infobar. |
175 bool tab_fullscreen_accepted_; | 174 bool tab_fullscreen_accepted_; |
176 | 175 |
177 // True if this controller has toggled into tab OR browser fullscreen. | 176 // True if this controller has toggled into tab OR browser fullscreen. |
178 bool toggled_into_fullscreen_; | 177 bool toggled_into_fullscreen_; |
179 | 178 |
180 // TabContents for current tab requesting or currently in mouse lock. | 179 // WebContents for current tab requesting or currently in mouse lock. |
181 // Assign using SetMouseLockTab(). | 180 // Assign using SetMouseLockTab(). |
182 TabContents* mouse_lock_tab_; | 181 content::WebContents* mouse_lock_tab_; |
183 | 182 |
184 MouseLockState mouse_lock_state_; | 183 MouseLockState mouse_lock_state_; |
185 | 184 |
186 content::NotificationRegistrar registrar_; | 185 content::NotificationRegistrar registrar_; |
187 | 186 |
188 // Used to verify that calls we expect to reenter by calling | 187 // Used to verify that calls we expect to reenter by calling |
189 // WindowFullscreenStateChanged do so. | 188 // WindowFullscreenStateChanged do so. |
190 bool reentrant_window_state_change_call_check_; | 189 bool reentrant_window_state_change_call_check_; |
191 | 190 |
192 DISALLOW_COPY_AND_ASSIGN(FullscreenController); | 191 DISALLOW_COPY_AND_ASSIGN(FullscreenController); |
193 }; | 192 }; |
194 | 193 |
195 #endif // CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_ | 194 #endif // CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_ |
OLD | NEW |