OLD | NEW |
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 |
| 14 |
| 15 class BrowserView; |
13 | 16 |
14 namespace content { | 17 namespace content { |
15 class WebContents; | 18 class WebContents; |
16 } | 19 } |
17 | 20 |
18 namespace gfx { | 21 namespace gfx { |
19 class Rect; | 22 class Rect; |
20 class Size; | 23 class Size; |
21 } | 24 } |
22 | 25 |
23 namespace views { | 26 #if defined(USE_ASH) |
24 class View; | 27 typedef ash::ImmersiveRevealedLock ImmersiveRevealedLock; |
25 class Widget; | 28 #else |
26 } | 29 // 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 { | 30 class ImmersiveRevealedLock { |
32 public: | 31 public: |
33 virtual ~ImmersiveRevealedLock() {} | 32 ImmersiveRevealedLock() {} |
| 33 ~ImmersiveRevealedLock() {} |
34 }; | 34 }; |
| 35 #endif |
35 | 36 |
36 // Controller for an "immersive mode" similar to MacOS presentation mode where | 37 // 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 | 38 // 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" | 39 // screen. The tab strip is optionally painted with miniature "tab indicator" |
39 // rectangles. | 40 // rectangles. |
40 // Currently, immersive mode is only available for Chrome OS. | 41 // Currently, immersive mode is only available for Chrome OS. |
41 class ImmersiveModeController { | 42 class ImmersiveModeController { |
42 public: | 43 public: |
43 enum AnimateReveal { | 44 enum AnimateReveal { |
44 ANIMATE_REVEAL_YES, | 45 ANIMATE_REVEAL_YES, |
45 ANIMATE_REVEAL_NO | 46 ANIMATE_REVEAL_NO |
46 }; | 47 }; |
47 | 48 |
48 class Observer { | 49 class Observer { |
49 public: | 50 public: |
50 // Called when a reveal of the top-of-window views has been initiated. | 51 // Called when a reveal of the top-of-window views has been initiated. |
51 virtual void OnImmersiveRevealStarted() {} | 52 virtual void OnImmersiveRevealStarted() {} |
52 | 53 |
53 // Called when the immersive mode controller has been destroyed. | 54 // Called when the immersive mode controller has been destroyed. |
54 virtual void OnImmersiveModeControllerDestroyed() {} | 55 virtual void OnImmersiveModeControllerDestroyed() {} |
55 | 56 |
56 protected: | 57 protected: |
57 virtual ~Observer() {} | 58 virtual ~Observer() {} |
58 }; | 59 }; |
59 | 60 |
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(); | 61 ImmersiveModeController(); |
80 virtual ~ImmersiveModeController(); | 62 virtual ~ImmersiveModeController(); |
81 | 63 |
82 // Must initialize after browser view has a Widget and native window. | 64 // Must initialize after browser view has a Widget and native window. |
83 virtual void Init(Delegate* delegate, | 65 virtual void Init(BrowserView* browser_view) = 0; |
84 views::Widget* widget, | |
85 views::View* top_container) = 0; | |
86 | 66 |
87 // Enables or disables immersive mode. | 67 // Enables or disables immersive mode. |
88 virtual void SetEnabled(bool enabled) = 0; | 68 virtual void SetEnabled(bool enabled) = 0; |
89 virtual bool IsEnabled() const = 0; | 69 virtual bool IsEnabled() const = 0; |
90 | 70 |
91 // True if the miniature "tab indicators" should be hidden in the main browser | 71 // True if the miniature "tab indicators" should be hidden in the main browser |
92 // view when immersive mode is enabled. | 72 // view when immersive mode is enabled. |
93 virtual bool ShouldHideTabIndicators() const = 0; | 73 virtual bool ShouldHideTabIndicators() const = 0; |
94 | 74 |
95 // True when the top views are hidden due to immersive mode. | 75 // True when the top views are hidden due to immersive mode. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 }; | 122 }; |
143 | 123 |
144 namespace chrome { | 124 namespace chrome { |
145 | 125 |
146 // Implemented in immersive_mode_controller_factory.cc. | 126 // Implemented in immersive_mode_controller_factory.cc. |
147 ImmersiveModeController* CreateImmersiveModeController(); | 127 ImmersiveModeController* CreateImmersiveModeController(); |
148 | 128 |
149 } // namespace chrome | 129 } // namespace chrome |
150 | 130 |
151 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ | 131 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ |
OLD | NEW |