Index: chrome/browser/ui/fullscreen_controller.h |
diff --git a/chrome/browser/ui/fullscreen_controller.h b/chrome/browser/ui/fullscreen_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a8871488d9cebfb49e7a41d099e33a37a34a07d9 |
--- /dev/null |
+++ b/chrome/browser/ui/fullscreen_controller.h |
@@ -0,0 +1,102 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_ |
+#define CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_ |
+#pragma once |
+ |
+#include "base/task.h" |
+#include "chrome/common/content_settings.h" |
+#include "googleurl/src/gurl.h" |
+ |
+class Profile; |
yzshen1
2011/11/04 01:56:32
Sort them, please.
koz (OOO until 15th September)
2011/11/06 23:30:20
Done.
|
+class Browser; |
+class BrowserWindow; |
+class TabContents; |
+class TabContentsWrapper; |
+ |
+// There are two different kinds of fullscreen mode - "tab fullscreen" and |
Peter Kasting
2011/11/03 18:24:56
Nit: Seems like this is line-wrapped much earlier
koz (OOO until 15th September)
2011/11/06 23:30:20
Done.
|
+// "browser fullscreen". "Tab fullscreen" refers to when a tab enters |
+// fullscreen mode via the JS fullscreen API, and "browser fullscreen" |
+// refers to the user putting the browser itself into fullscreen mode from |
+// the UI. The difference is that tab fullscreen has implications for how |
+// the contents of the tab render (eg: a video element may grow to consume |
+// the whole tab), whereas browser fullscreen mode doesn't. Therefore if a |
+// user forces an exit from fullscreen, we need to notify the tab so it can |
Peter Kasting
2011/11/03 18:24:56
Nit: exit from fullscreen -> exit from tab fullscr
koz (OOO until 15th September)
2011/11/06 23:30:20
Done.
|
+// stop rendering in its fullscreen mode. |
+ |
+// This class implements fullscreen and mouselock behaviour. |
+class FullscreenController { |
+ public: |
+ FullscreenController(BrowserWindow* window, |
Peter Kasting
2011/11/03 18:24:56
Nit: Since Browser has window() and profile() acce
koz (OOO until 15th September)
2011/11/06 23:30:20
I'd prefer to continue down the path of removing d
|
+ Profile* profile, |
+ Browser* browser); |
+ ~FullscreenController(); |
Peter Kasting
2011/11/03 18:24:56
This does not seem to be defined in the .cc file?
koz (OOO until 15th September)
2011/11/06 23:30:20
Done.
|
+ |
+ // Querying. |
+ bool IsFullscreenForTab() const; |
+ bool IsFullscreenForTab(const TabContents* tab) const; |
+ |
+ // Requests. |
+ void RequestToLockMouse(TabContents* tab); |
+ void ToggleFullscreenModeForTab(TabContents* tab, bool enter_fullscreen); |
+#if defined(OS_MACOSX) |
+ void TogglePresentationMode(bool for_tab); |
+#endif |
+ // TODO(koz): Change |for_tab| to an enum. |
+ void ToggleFullscreenMode(bool for_tab); |
+ |
+ // Notifications. |
+ void LostMouseLock(); |
+ void OnTabClosing(TabContents* tab_contents); |
+ void OnTabDeactivated(TabContentsWrapper* contents); |
+ void OnAcceptFullscreenPermission(const GURL& url, |
+ FullscreenExitBubbleType bubble_type); |
yzshen1
2011/11/04 01:56:32
It seems you need to included .h for FullscreenExi
koz (OOO until 15th September)
2011/11/06 23:30:20
Done.
|
+ void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type); |
+ void WindowFullscreenStateChanged(); |
+ bool HandleUserPressedEscape(); |
+ |
yzshen1
2011/11/04 01:56:32
One empty line?
koz (OOO until 15th September)
2011/11/06 23:30:20
Done.
|
+ |
+ private: |
+ 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 |
+ }; |
+ |
+ // Notifies the tab that it has been forced out of fullscreen mode if |
+ // necessary. |
+ void NotifyTabOfFullscreenExitIfNecessary(); |
+ // Make the current tab exit fullscreen mode if it is in it. |
+ void ExitTabbedFullscreenModeIfNecessary(); |
+ void UpdateFullscreenExitBubbleContent(); |
+ void NotifyFullscreenChange(); |
+ FullscreenExitBubbleType GetFullscreenExitBubbleType() const; |
+ ContentSetting GetFullscreenSetting(const GURL& url); |
Peter Kasting
2011/11/03 18:24:56
Nit: Can these two functions be const?
koz (OOO until 15th September)
2011/11/06 23:30:20
Done.
|
+ ContentSetting GetMouseLockSetting(const GURL& url); |
+ |
+ BrowserWindow* window_; |
+ Profile* profile_; |
+ Browser* browser_; |
+ |
+ // If there is currently a tab in fullscreen mode (entered via |
+ // webkitRequestFullScreen), this is its wrapper. |
+ TabContentsWrapper* fullscreened_tab_; |
+ |
+ // True if the current tab entered fullscreen mode via webkitRequestFullScreen |
+ bool tab_caused_fullscreen_; |
+ // True if tab fullscreen has been allowed, either by settings or by user |
+ // clicking the allow button on the fullscreen infobar. |
+ bool tab_fullscreen_accepted_; |
+ |
+ MouseLockState mouse_lock_state_; |
+ |
+ // The following factory is used to close the frame at a later time. |
+ ScopedRunnableMethodFactory<FullscreenController> method_factory_; |
+}; |
yzshen1
2011/11/04 01:56:32
Disallow copy and assign?
koz (OOO until 15th September)
2011/11/06 23:30:20
Done.
|
+ |
+#endif // CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_ |