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

Side by Side Diff: chrome/browser/ui/views/frame/immersive_mode_controller.h

Issue 48963002: [Refactor] Move the non-browser specific logic of ImmersiveModeControllerAsh into ash part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 10
11 class BookmarkBarView; 11 #if defined(USE_ASH)
12 class FullscreenController; 12 #include "ash/wm/immersive_revealed_lock.h"
13 #endif
13 14
14 namespace content { 15 class BrowserView;
15 class WebContents;
16 }
17 16
18 namespace gfx { 17 namespace gfx {
19 class Rect; 18 class Rect;
20 class Size; 19 class Size;
21 } 20 }
22 21
23 namespace views { 22 #if defined(USE_ASH)
24 class View; 23 typedef ash::ImmersiveRevealedLock ImmersiveRevealedLock;
25 class Widget; 24 #else
26 } 25 // Do nothing version of ash::ImmersiveRevealedLock.
27
28 // Base class for a lock which keeps the top-of-window views revealed for the
29 // duration of its lifetime. See ImmersiveModeController::GetRevealedLock() for
30 // more details.
31 class ImmersiveRevealedLock { 26 class ImmersiveRevealedLock {
32 public: 27 public:
33 virtual ~ImmersiveRevealedLock() {} 28 ImmersiveRevealedLock() {}
29 ~ImmersiveRevealedLock() {}
34 }; 30 };
31 #endif
35 32
36 // Controller for an "immersive mode" similar to MacOS presentation mode where 33 // Controller for an "immersive mode" similar to MacOS presentation mode where
37 // the top-of-window views are hidden until the mouse hits the top of the 34 // the top-of-window views are hidden until the mouse hits the top of the
38 // screen. The tab strip is optionally painted with miniature "tab indicator" 35 // screen. The tab strip is optionally painted with miniature "tab indicator"
39 // rectangles. 36 // rectangles.
40 // Currently, immersive mode is only available for Chrome OS. 37 // Currently, immersive mode is only available for Chrome OS.
41 class ImmersiveModeController { 38 class ImmersiveModeController {
42 public: 39 public:
43 enum AnimateReveal { 40 enum AnimateReveal {
44 ANIMATE_REVEAL_YES, 41 ANIMATE_REVEAL_YES,
45 ANIMATE_REVEAL_NO 42 ANIMATE_REVEAL_NO
46 }; 43 };
47 44
48 class Observer { 45 class Observer {
49 public: 46 public:
50 // Called when a reveal of the top-of-window views has been initiated. 47 // Called when a reveal of the top-of-window views has been initiated.
51 virtual void OnImmersiveRevealStarted() {} 48 virtual void OnImmersiveRevealStarted() {}
52 49
53 // Called when the immersive mode controller has been destroyed. 50 // Called when the immersive mode controller has been destroyed.
54 virtual void OnImmersiveModeControllerDestroyed() {} 51 virtual void OnImmersiveModeControllerDestroyed() {}
55 52
56 protected: 53 protected:
57 virtual ~Observer() {} 54 virtual ~Observer() {}
58 }; 55 };
59 56
60 class Delegate {
61 public:
62 // Returns the browser's FullscreenController.
63 virtual FullscreenController* GetFullscreenController() = 0;
64
65 // Returns the browser's active web contents for the active tab, or NULL if
66 // such does not exist.
67 virtual content::WebContents* GetWebContents() = 0;
68
69 // Notifies the delegate that fullscreen has been entered or exited.
70 virtual void FullscreenStateChanged() = 0;
71
72 // Requests that the tab strip be painted in a short, "light bar" style.
73 virtual void SetImmersiveStyle(bool immersive) = 0;
74
75 protected:
76 virtual ~Delegate() {}
77 };
78
79 ImmersiveModeController(); 57 ImmersiveModeController();
80 virtual ~ImmersiveModeController(); 58 virtual ~ImmersiveModeController();
81 59
82 // Must initialize after browser view has a Widget and native window. 60 // Must initialize after browser view has a Widget and native window.
83 virtual void Init(Delegate* delegate, 61 virtual void Init(BrowserView* browser_view) = 0;
84 views::Widget* widget,
85 views::View* top_container) = 0;
86 62
87 // Enables or disables immersive mode. 63 // Enables or disables immersive mode.
88 virtual void SetEnabled(bool enabled) = 0; 64 virtual void SetEnabled(bool enabled) = 0;
89 virtual bool IsEnabled() const = 0; 65 virtual bool IsEnabled() const = 0;
90 66
91 // True if the miniature "tab indicators" should be hidden in the main browser 67 // True if the miniature "tab indicators" should be hidden in the main browser
92 // view when immersive mode is enabled. 68 // view when immersive mode is enabled.
93 virtual bool ShouldHideTabIndicators() const = 0; 69 virtual bool ShouldHideTabIndicators() const = 0;
94 70
95 // True when the top views are hidden due to immersive mode. 71 // True when the top views are hidden due to immersive mode.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 }; 118 };
143 119
144 namespace chrome { 120 namespace chrome {
145 121
146 // Implemented in immersive_mode_controller_factory.cc. 122 // Implemented in immersive_mode_controller_factory.cc.
147 ImmersiveModeController* CreateImmersiveModeController(); 123 ImmersiveModeController* CreateImmersiveModeController();
148 124
149 } // namespace chrome 125 } // namespace chrome
150 126
151 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ 127 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698