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

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: replace reset() with 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/browser/ui/fullscreen_exit_bubble_type.h"
11 #include "chrome/common/content_settings.h"
tfarina 2011/11/06 23:36:18 Can you forward declare this too?
koz (OOO until 15th September) 2011/11/06 23:50:25 No, I use a non-reference to it in GetFullscreenSe
12 #include "googleurl/src/gurl.h"
tfarina 2011/11/06 23:36:18 You can forward declare this instead.
koz (OOO until 15th September) 2011/11/06 23:50:25 Done.
13
14 class Browser;
15 class BrowserWindow;
16 class Profile;
17 class TabContents;
18 class TabContentsWrapper;
19
20 // There are two different kinds of fullscreen mode - "tab fullscreen" and
21 // "browser fullscreen". "Tab fullscreen" refers to when a tab enters
22 // fullscreen mode via the JS fullscreen API, and "browser fullscreen" refers
23 // to the user putting the browser itself into fullscreen mode from the UI. The
24 // difference is that tab fullscreen has implications for how the contents of
25 // the tab render (eg: a video element may grow to consume the whole tab),
26 // whereas browser fullscreen mode doesn't. Therefore if a user forces an exit
27 // from tab fullscreen, we need to notify the tab so it can stop rendering in
28 // its fullscreen mode.
29
30 // This class implements fullscreen and mouselock behaviour.
31 class FullscreenController : public base::RefCounted<FullscreenController> {
tfarina 2011/11/06 23:36:18 include base/memory/ref_counted.h
koz (OOO until 15th September) 2011/11/06 23:50:25 Done.
32 public:
33 FullscreenController(BrowserWindow* window,
34 Profile* profile,
35 Browser* browser);
36 virtual ~FullscreenController();
37
38 // Querying.
39 bool IsFullscreenForTab() const;
40 bool IsFullscreenForTab(const TabContents* tab) const;
41
42 // Requests.
43 void RequestToLockMouse(TabContents* tab);
44 void ToggleFullscreenModeForTab(TabContents* tab, bool enter_fullscreen);
45 #if defined(OS_MACOSX)
46 void TogglePresentationMode(bool for_tab);
47 #endif
48 // TODO(koz): Change |for_tab| to an enum.
49 void ToggleFullscreenMode(bool for_tab);
50
51 // Notifications.
52 void LostMouseLock();
53 void OnTabClosing(TabContents* tab_contents);
54 void OnTabDeactivated(TabContentsWrapper* contents);
55 void OnAcceptFullscreenPermission(const GURL& url,
56 FullscreenExitBubbleType bubble_type);
57 void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type);
58 void WindowFullscreenStateChanged();
59 bool HandleUserPressedEscape();
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) const;
80 ContentSetting GetMouseLockSetting(const GURL& url) const;
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_;
tfarina 2011/11/06 23:36:18 Change this to base::WeakPtrFactory
koz (OOO until 15th September) 2011/11/06 23:50:25 Actually, this is unused now (after translating to
100
101 DISALLOW_COPY_AND_ASSIGN(FullscreenController);
tfarina 2011/11/06 23:36:18 include base/basictypes.h for this.
koz (OOO until 15th September) 2011/11/06 23:50:25 Done.
102 };
103
104 #endif // CHROME_BROWSER_UI_FULLSCREEN_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.mm ('k') | chrome/browser/ui/fullscreen_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698