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 | 10 |
10 class BookmarkBarView; | 11 class BookmarkBarView; |
11 class FullscreenController; | 12 class FullscreenController; |
12 | 13 |
13 namespace gfx { | 14 namespace gfx { |
14 class Size; | 15 class Size; |
15 } | 16 } |
16 | 17 |
17 namespace views { | 18 namespace views { |
18 class View; | 19 class View; |
(...skipping 13 matching lines...) Expand all Loading... | |
32 // screen. The tab strip is optionally painted with miniature "tab indicator" | 33 // screen. The tab strip is optionally painted with miniature "tab indicator" |
33 // rectangles. | 34 // rectangles. |
34 // Currently, immersive mode is only available for Chrome OS. | 35 // Currently, immersive mode is only available for Chrome OS. |
35 class ImmersiveModeController { | 36 class ImmersiveModeController { |
36 public: | 37 public: |
37 enum AnimateReveal { | 38 enum AnimateReveal { |
38 ANIMATE_REVEAL_YES, | 39 ANIMATE_REVEAL_YES, |
39 ANIMATE_REVEAL_NO | 40 ANIMATE_REVEAL_NO |
40 }; | 41 }; |
41 | 42 |
43 class Observer { | |
44 public: | |
45 virtual ~Observer() {} | |
sky
2013/06/19 13:32:29
Make this protected.
| |
46 | |
47 // Called when a reveal of the top-of-window views has been initiated. | |
48 virtual void OnImmersiveRevealStarted() {} | |
49 | |
50 // Called when the immersive mode controller has been destroyed. | |
51 virtual void OnImmersiveModeControllerDestroyed() {} | |
52 }; | |
53 | |
42 class Delegate { | 54 class Delegate { |
43 public: | 55 public: |
44 // Returns the bookmark bar, or NULL if the window does not support one. | 56 // Returns the bookmark bar, or NULL if the window does not support one. |
45 virtual BookmarkBarView* GetBookmarkBar() = 0; | 57 virtual BookmarkBarView* GetBookmarkBar() = 0; |
46 | 58 |
47 // Returns the browser's FullscreenController. | 59 // Returns the browser's FullscreenController. |
48 virtual FullscreenController* GetFullscreenController() = 0; | 60 virtual FullscreenController* GetFullscreenController() = 0; |
49 | 61 |
50 // Notifies the delegate that fullscreen has been entered or exited. | 62 // Notifies the delegate that fullscreen has been entered or exited. |
51 virtual void FullscreenStateChanged() = 0; | 63 virtual void FullscreenStateChanged() = 0; |
52 | 64 |
53 // Requests that the tab strip be painted in a short, "light bar" style. | 65 // Requests that the tab strip be painted in a short, "light bar" style. |
54 virtual void SetImmersiveStyle(bool immersive) = 0; | 66 virtual void SetImmersiveStyle(bool immersive) = 0; |
55 | 67 |
56 protected: | 68 protected: |
57 virtual ~Delegate() {} | 69 virtual ~Delegate() {} |
58 }; | 70 }; |
59 | 71 |
60 virtual ~ImmersiveModeController() {} | 72 ImmersiveModeController(); |
73 virtual ~ImmersiveModeController(); | |
61 | 74 |
62 // Must initialize after browser view has a Widget and native window. | 75 // Must initialize after browser view has a Widget and native window. |
63 virtual void Init(Delegate* delegate, | 76 virtual void Init(Delegate* delegate, |
64 views::Widget* widget, | 77 views::Widget* widget, |
65 views::View* top_container) = 0; | 78 views::View* top_container) = 0; |
66 | 79 |
67 // Enables or disables immersive mode. | 80 // Enables or disables immersive mode. |
68 virtual void SetEnabled(bool enabled) = 0; | 81 virtual void SetEnabled(bool enabled) = 0; |
69 virtual bool IsEnabled() const = 0; | 82 virtual bool IsEnabled() const = 0; |
70 | 83 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 virtual void AnchorWidgetToTopContainer(views::Widget* widget, | 126 virtual void AnchorWidgetToTopContainer(views::Widget* widget, |
114 int y_offset) = 0; | 127 int y_offset) = 0; |
115 | 128 |
116 // Stops managing |widget|'s y position. | 129 // Stops managing |widget|'s y position. |
117 // Closes the top-of-window views if no locks or other anchored widgets are | 130 // Closes the top-of-window views if no locks or other anchored widgets are |
118 // keeping the top-of-window views revealed. | 131 // keeping the top-of-window views revealed. |
119 virtual void UnanchorWidgetFromTopContainer(views::Widget* widget) = 0; | 132 virtual void UnanchorWidgetFromTopContainer(views::Widget* widget) = 0; |
120 | 133 |
121 // Called by the TopContainerView to indicate that its bounds have changed. | 134 // Called by the TopContainerView to indicate that its bounds have changed. |
122 virtual void OnTopContainerBoundsChanged() = 0; | 135 virtual void OnTopContainerBoundsChanged() = 0; |
136 | |
137 virtual void AddObserver(Observer* observer); | |
138 virtual void RemoveObserver(Observer* observer); | |
139 | |
140 protected: | |
141 ObserverList<Observer> observers_; | |
142 | |
143 private: | |
144 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeController); | |
123 }; | 145 }; |
124 | 146 |
125 namespace chrome { | 147 namespace chrome { |
126 | 148 |
127 // Implemented in immersive_mode_controller_factory.cc. | 149 // Implemented in immersive_mode_controller_factory.cc. |
128 ImmersiveModeController* CreateImmersiveModeController(); | 150 ImmersiveModeController* CreateImmersiveModeController(); |
129 | 151 |
130 } // namespace chrome | 152 } // namespace chrome |
131 | 153 |
132 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ | 154 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ |
OLD | NEW |