Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: chrome/browser/ui/fullscreen/fullscreen_controller.h

Issue 23477051: Embed Flash Fullscreen widget within browser window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add caution comment to chrome_switches.cc. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 19
20 namespace content { 20 namespace content {
21 class WebContents; 21 class WebContents;
22 } 22 }
23 23
24 // There are two different kinds of fullscreen mode - "tab fullscreen" and 24 // There are two different kinds of fullscreen mode - "tab fullscreen" and
25 // "browser fullscreen". "Tab fullscreen" refers to when a tab enters 25 // "browser fullscreen". "Tab fullscreen" refers to a renderer-initiated
26 // fullscreen mode via the JS fullscreen API, and "browser fullscreen" refers 26 // fullscreen mode (eg: from a Flash plugin or via the JS fullscreen API),
27 // to the user putting the browser itself into fullscreen mode from the UI. The 27 // whereas "browser fullscreen" refers to the user putting the browser itself
28 // difference is that tab fullscreen has implications for how the contents of 28 // into fullscreen mode from the UI. The difference is that tab fullscreen has
29 // the tab render (eg: a video element may grow to consume the whole tab), 29 // implications for how the contents of the tab render (eg: a video element may
30 // whereas browser fullscreen mode doesn't. Therefore if a user forces an exit 30 // grow to consume the whole tab), whereas browser fullscreen mode doesn't.
31 // from tab fullscreen, we need to notify the tab so it can stop rendering in 31 // Therefore if a user forces an exit from tab fullscreen, we need to notify the
32 // its fullscreen mode. 32 // tab so it can stop rendering in its fullscreen mode.
33 //
34 // For Flash, FullscreenController will auto-accept all permission requests for
35 // fullscreen and/or mouse lock, since the assumption is that the plugin handles
36 // this for us.
33 37
34 // This class implements fullscreen and mouselock behaviour. 38 // This class implements fullscreen and mouselock behaviour.
35 class FullscreenController : public content::NotificationObserver { 39 class FullscreenController : public content::NotificationObserver {
36 public: 40 public:
37 explicit FullscreenController(Browser* browser); 41 explicit FullscreenController(Browser* browser);
38 virtual ~FullscreenController(); 42 virtual ~FullscreenController();
39 43
40 // Browser/User Fullscreen /////////////////////////////////////////////////// 44 // Browser/User Fullscreen ///////////////////////////////////////////////////
41 45
42 // Returns true if the window is currently fullscreen and was initially 46 // Returns true if the window is currently fullscreen and was initially
43 // transitioned to fullscreen by a browser (vs tab) mode transition. 47 // transitioned to fullscreen by a browser (vs tab) mode transition.
44 bool IsFullscreenForBrowser() const; 48 bool IsFullscreenForBrowser() const;
45 49
46 void ToggleFullscreenMode(); 50 void ToggleFullscreenMode();
47 51
48 // Tab/HTML Fullscreen /////////////////////////////////////////////////////// 52 // Tab/HTML/Flash Fullscreen /////////////////////////////////////////////////
49 53
50 // Returns true if fullscreen has been caused by a tab. 54 // Returns true if fullscreen has been caused by a tab.
51 // The window may still be transitioning, and window_->IsFullscreen() 55 // The window may still be transitioning, and window_->IsFullscreen()
52 // may still return false. 56 // may still return false.
53 bool IsFullscreenForTabOrPending() const; 57 bool IsFullscreenForTabOrPending() const;
54 bool IsFullscreenForTabOrPending( 58 bool IsFullscreenForTabOrPending(
55 const content::WebContents* web_contents) const; 59 const content::WebContents* web_contents) const;
56 // True if fullscreen was entered because of tab fullscreen (was not 60 // True if fullscreen was entered because of tab fullscreen (was not
57 // previously in browser fullscreen). 61 // previously in browser fullscreen).
58 bool IsFullscreenCausedByTab() const; 62 bool IsFullscreenCausedByTab() const;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 virtual void Observe(int type, 119 virtual void Observe(int type,
116 const content::NotificationSource& source, 120 const content::NotificationSource& source,
117 const content::NotificationDetails& details) OVERRIDE; 121 const content::NotificationDetails& details) OVERRIDE;
118 122
119 // Bubble Content //////////////////////////////////////////////////////////// 123 // Bubble Content ////////////////////////////////////////////////////////////
120 124
121 GURL GetFullscreenExitBubbleURL() const; 125 GURL GetFullscreenExitBubbleURL() const;
122 FullscreenExitBubbleType GetFullscreenExitBubbleType() const; 126 FullscreenExitBubbleType GetFullscreenExitBubbleType() const;
123 127
124 private: 128 private:
129 friend class FullscreenControllerTest;
130
125 enum MouseLockState { 131 enum MouseLockState {
126 MOUSELOCK_NOT_REQUESTED, 132 MOUSELOCK_NOT_REQUESTED,
127 // The page requests to lock the mouse and the user hasn't responded to the 133 // The page requests to lock the mouse and the user hasn't responded to the
128 // request. 134 // request.
129 MOUSELOCK_REQUESTED, 135 MOUSELOCK_REQUESTED,
130 // Mouse lock has been allowed by the user. 136 // Mouse lock has been allowed by the user.
131 MOUSELOCK_ACCEPTED, 137 MOUSELOCK_ACCEPTED,
132 // Mouse lock has been silently accepted, no notification to user. 138 // Mouse lock has been silently accepted, no notification to user.
133 MOUSELOCK_ACCEPTED_SILENTLY 139 MOUSELOCK_ACCEPTED_SILENTLY
134 }; 140 };
(...skipping 23 matching lines...) Expand all
158 void SetFullscreenedTab(content::WebContents* tab); 164 void SetFullscreenedTab(content::WebContents* tab);
159 void SetMouseLockTab(content::WebContents* tab); 165 void SetMouseLockTab(content::WebContents* tab);
160 166
161 // Make the current tab exit fullscreen mode or mouse lock if it is in it. 167 // Make the current tab exit fullscreen mode or mouse lock if it is in it.
162 void ExitTabFullscreenOrMouseLockIfNecessary(); 168 void ExitTabFullscreenOrMouseLockIfNecessary();
163 void UpdateFullscreenExitBubbleContent(); 169 void UpdateFullscreenExitBubbleContent();
164 170
165 ContentSetting GetFullscreenSetting(const GURL& url) const; 171 ContentSetting GetFullscreenSetting(const GURL& url) const;
166 ContentSetting GetMouseLockSetting(const GURL& url) const; 172 ContentSetting GetMouseLockSetting(const GURL& url) const;
167 173
174 bool IsPrivilegedFullscreenForTab() const;
175 void SetPrivilegedFullscreenForTesting(bool is_privileged);
176 void UnlockMouse();
177
168 base::WeakPtrFactory<FullscreenController> ptr_factory_; 178 base::WeakPtrFactory<FullscreenController> ptr_factory_;
169 179
170 Browser* browser_; 180 Browser* const browser_;
171 BrowserWindow* window_; 181 BrowserWindow* const window_;
172 Profile* profile_; 182 Profile* const profile_;
173 183
174 // If there is currently a tab in fullscreen mode (entered via 184 // If there is currently a tab in fullscreen mode (entered via
175 // webkitRequestFullScreen), this is its WebContents. 185 // webkitRequestFullScreen), this is its WebContents.
176 // Assign using SetFullscreenedTab(). 186 // Assign using SetFullscreenedTab().
177 content::WebContents* fullscreened_tab_; 187 content::WebContents* fullscreened_tab_;
178 188
179 // The URL of the extension which trigerred "browser fullscreen" mode. 189 // The URL of the extension which trigerred "browser fullscreen" mode.
180 GURL extension_caused_fullscreen_; 190 GURL extension_caused_fullscreen_;
181 191
182 enum PriorFullscreenState { 192 enum PriorFullscreenState {
(...skipping 19 matching lines...) Expand all
202 content::WebContents* mouse_lock_tab_; 212 content::WebContents* mouse_lock_tab_;
203 213
204 MouseLockState mouse_lock_state_; 214 MouseLockState mouse_lock_state_;
205 215
206 content::NotificationRegistrar registrar_; 216 content::NotificationRegistrar registrar_;
207 217
208 // Used to verify that calls we expect to reenter by calling 218 // Used to verify that calls we expect to reenter by calling
209 // WindowFullscreenStateChanged do so. 219 // WindowFullscreenStateChanged do so.
210 bool reentrant_window_state_change_call_check_; 220 bool reentrant_window_state_change_call_check_;
211 221
222 // Used in testing to confirm proper behavior for specific, privileged
223 // fullscreen cases.
224 bool is_privileged_fullscreen_for_testing_;
225
212 DISALLOW_COPY_AND_ASSIGN(FullscreenController); 226 DISALLOW_COPY_AND_ASSIGN(FullscreenController);
213 }; 227 };
214 228
215 #endif // CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_ 229 #endif // CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm ('k') | chrome/browser/ui/fullscreen/fullscreen_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698