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

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

Issue 8423035: Split out fullscreen logic from Browser into FullscreenController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 9 years, 1 month 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_
7 #pragma once
8
9 #include "base/task.h"
10 #include "chrome/common/content_settings.h"
11 #include "googleurl/src/gurl.h"
12
13 class Profile;
yzshen1 2011/11/04 01:56:32 Sort them, please.
koz (OOO until 15th September) 2011/11/06 23:30:20 Done.
14 class Browser;
15 class BrowserWindow;
16 class TabContents;
17 class TabContentsWrapper;
18
19 // 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.
20 // "browser fullscreen". "Tab fullscreen" refers to when a tab enters
21 // fullscreen mode via the JS fullscreen API, and "browser fullscreen"
22 // refers to the user putting the browser itself into fullscreen mode from
23 // the UI. The difference is that tab fullscreen has implications for how
24 // the contents of the tab render (eg: a video element may grow to consume
25 // the whole tab), whereas browser fullscreen mode doesn't. Therefore if a
26 // 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.
27 // stop rendering in its fullscreen mode.
28
29 // This class implements fullscreen and mouselock behaviour.
30 class FullscreenController {
31 public:
32 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
33 Profile* profile,
34 Browser* browser);
35 ~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.
36
37 // Querying.
38 bool IsFullscreenForTab() const;
39 bool IsFullscreenForTab(const TabContents* tab) const;
40
41 // Requests.
42 void RequestToLockMouse(TabContents* tab);
43 void ToggleFullscreenModeForTab(TabContents* tab, bool enter_fullscreen);
44 #if defined(OS_MACOSX)
45 void TogglePresentationMode(bool for_tab);
46 #endif
47 // TODO(koz): Change |for_tab| to an enum.
48 void ToggleFullscreenMode(bool for_tab);
49
50 // Notifications.
51 void LostMouseLock();
52 void OnTabClosing(TabContents* tab_contents);
53 void OnTabDeactivated(TabContentsWrapper* contents);
54 void OnAcceptFullscreenPermission(const GURL& url,
55 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.
56 void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type);
57 void WindowFullscreenStateChanged();
58 bool HandleUserPressedEscape();
59
yzshen1 2011/11/04 01:56:32 One empty line?
koz (OOO until 15th September) 2011/11/06 23:30:20 Done.
60
61 private:
62 enum MouseLockState {
63 MOUSELOCK_NOT_REQUESTED,
64 // The page requests to lock the mouse and the user hasn't responded to the
65 // request.
66 MOUSELOCK_REQUESTED,
67 // Mouse lock has been allowed by the user.
68 MOUSELOCK_ACCEPTED
69 };
70
71 // Notifies the tab that it has been forced out of fullscreen mode if
72 // necessary.
73 void NotifyTabOfFullscreenExitIfNecessary();
74 // Make the current tab exit fullscreen mode if it is in it.
75 void ExitTabbedFullscreenModeIfNecessary();
76 void UpdateFullscreenExitBubbleContent();
77 void NotifyFullscreenChange();
78 FullscreenExitBubbleType GetFullscreenExitBubbleType() const;
79 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.
80 ContentSetting GetMouseLockSetting(const GURL& url);
81
82 BrowserWindow* window_;
83 Profile* profile_;
84 Browser* browser_;
85
86 // If there is currently a tab in fullscreen mode (entered via
87 // webkitRequestFullScreen), this is its wrapper.
88 TabContentsWrapper* fullscreened_tab_;
89
90 // True if the current tab entered fullscreen mode via webkitRequestFullScreen
91 bool tab_caused_fullscreen_;
92 // True if tab fullscreen has been allowed, either by settings or by user
93 // clicking the allow button on the fullscreen infobar.
94 bool tab_fullscreen_accepted_;
95
96 MouseLockState mouse_lock_state_;
97
98 // The following factory is used to close the frame at a later time.
99 ScopedRunnableMethodFactory<FullscreenController> method_factory_;
100 };
yzshen1 2011/11/04 01:56:32 Disallow copy and assign?
koz (OOO until 15th September) 2011/11/06 23:30:20 Done.
101
102 #endif // CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698