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/macros.h" | 9 #include "base/macros.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // screen. The tab strip is optionally painted with miniature "tab indicator" | 32 // screen. The tab strip is optionally painted with miniature "tab indicator" |
33 // rectangles. | 33 // rectangles. |
34 // Currently, immersive mode is only available for Chrome OS. | 34 // Currently, immersive mode is only available for Chrome OS. |
35 class ImmersiveModeController { | 35 class ImmersiveModeController { |
36 public: | 36 public: |
37 enum AnimateReveal { | 37 enum AnimateReveal { |
38 ANIMATE_REVEAL_YES, | 38 ANIMATE_REVEAL_YES, |
39 ANIMATE_REVEAL_NO | 39 ANIMATE_REVEAL_NO |
40 }; | 40 }; |
41 | 41 |
| 42 // TODO(sky): remove this, temporary while supporting both ash and mash. |
| 43 enum class Type { |
| 44 ASH, |
| 45 STUB, |
| 46 }; |
| 47 |
42 class Observer { | 48 class Observer { |
43 public: | 49 public: |
44 // Called when a reveal of the top-of-window views has been initiated. | 50 // Called when a reveal of the top-of-window views has been initiated. |
45 virtual void OnImmersiveRevealStarted() {} | 51 virtual void OnImmersiveRevealStarted() {} |
46 | 52 |
47 // Called when the immersive mode controller has been destroyed. | 53 // Called when the immersive mode controller has been destroyed. |
48 virtual void OnImmersiveModeControllerDestroyed() {} | 54 virtual void OnImmersiveModeControllerDestroyed() {} |
49 | 55 |
50 protected: | 56 protected: |
51 virtual ~Observer() {} | 57 virtual ~Observer() {} |
52 }; | 58 }; |
53 | 59 |
54 ImmersiveModeController(); | 60 explicit ImmersiveModeController(Type type); |
55 virtual ~ImmersiveModeController(); | 61 virtual ~ImmersiveModeController(); |
56 | 62 |
57 // Must initialize after browser view has a Widget and native window. | 63 // Must initialize after browser view has a Widget and native window. |
58 virtual void Init(BrowserView* browser_view) = 0; | 64 virtual void Init(BrowserView* browser_view) = 0; |
59 | 65 |
60 // Enables or disables immersive mode. | 66 // Enables or disables immersive mode. |
61 virtual void SetEnabled(bool enabled) = 0; | 67 virtual void SetEnabled(bool enabled) = 0; |
62 virtual bool IsEnabled() const = 0; | 68 virtual bool IsEnabled() const = 0; |
63 | 69 |
64 // True if the miniature "tab indicators" should be hidden in the main browser | 70 // True if the miniature "tab indicators" should be hidden in the main browser |
(...skipping 28 matching lines...) Expand all Loading... |
93 // This is currently only supported on Ash. | 99 // This is currently only supported on Ash. |
94 virtual ImmersiveRevealedLock* GetRevealedLock( | 100 virtual ImmersiveRevealedLock* GetRevealedLock( |
95 AnimateReveal animate_reveal) WARN_UNUSED_RESULT = 0; | 101 AnimateReveal animate_reveal) WARN_UNUSED_RESULT = 0; |
96 | 102 |
97 // Called by the find bar to indicate that its visible bounds have changed. | 103 // Called by the find bar to indicate that its visible bounds have changed. |
98 // |new_visible_bounds_in_screen| should be empty if the find bar is not | 104 // |new_visible_bounds_in_screen| should be empty if the find bar is not |
99 // visible. | 105 // visible. |
100 virtual void OnFindBarVisibleBoundsChanged( | 106 virtual void OnFindBarVisibleBoundsChanged( |
101 const gfx::Rect& new_visible_bounds_in_screen) = 0; | 107 const gfx::Rect& new_visible_bounds_in_screen) = 0; |
102 | 108 |
103 // Disables animations and moves the mouse so that it is not over the | 109 Type type() const { return type_; } |
104 // top-of-window views for the sake of testing. Must be called before | |
105 // enabling immersive fullscreen. | |
106 virtual void SetupForTest() = 0; | |
107 | 110 |
108 virtual void AddObserver(Observer* observer); | 111 virtual void AddObserver(Observer* observer); |
109 virtual void RemoveObserver(Observer* observer); | 112 virtual void RemoveObserver(Observer* observer); |
110 | 113 |
111 protected: | 114 protected: |
112 base::ObserverList<Observer> observers_; | 115 base::ObserverList<Observer> observers_; |
113 | 116 |
114 private: | 117 private: |
| 118 const Type type_; |
| 119 |
115 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeController); | 120 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeController); |
116 }; | 121 }; |
117 | 122 |
118 namespace chrome { | 123 namespace chrome { |
119 | 124 |
120 // Implemented in immersive_mode_controller_factory.cc. | 125 // Implemented in immersive_mode_controller_factory.cc. |
121 ImmersiveModeController* CreateImmersiveModeController(); | 126 ImmersiveModeController* CreateImmersiveModeController(); |
122 | 127 |
123 } // namespace chrome | 128 } // namespace chrome |
124 | 129 |
125 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ | 130 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ |
OLD | NEW |