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