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

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

Issue 14340007: Hide the tab indicators and the shelf when in immersive + tab fullscreen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed kImmersiveModeKey Created 7 years, 8 months 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_ASH_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_
7 7
8 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 8 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
9 9
10 #include "base/timer.h" 10 #include "base/timer.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
11 #include "ui/base/events/event_handler.h" 13 #include "ui/base/events/event_handler.h"
12 #include "ui/compositor/layer_animation_observer.h" 14 #include "ui/compositor/layer_animation_observer.h"
13 #include "ui/views/focus/focus_manager.h" 15 #include "ui/views/focus/focus_manager.h"
14 #include "ui/views/widget/widget_observer.h" 16 #include "ui/views/widget/widget_observer.h"
15 17
16 class BrowserView; 18 class BrowserView;
17 19
18 namespace aura { 20 namespace aura {
19 class Window; 21 class Window;
20 } 22 }
21 23
22 namespace gfx { 24 namespace gfx {
23 class Transform; 25 class Transform;
24 } 26 }
25 27
26 namespace ui { 28 namespace ui {
27 class Layer; 29 class Layer;
28 } 30 }
29 31
30 namespace views { 32 namespace views {
31 class View; 33 class View;
32 } 34 }
33 35
34 class ImmersiveModeControllerAsh : public ImmersiveModeController, 36 class ImmersiveModeControllerAsh : public ImmersiveModeController,
37 public content::NotificationObserver,
35 public ui::EventHandler, 38 public ui::EventHandler,
36 public ui::ImplicitAnimationObserver, 39 public ui::ImplicitAnimationObserver,
37 public views::FocusChangeListener, 40 public views::FocusChangeListener,
38 public views::WidgetObserver { 41 public views::WidgetObserver {
39 public: 42 public:
40 ImmersiveModeControllerAsh(); 43 ImmersiveModeControllerAsh();
41 virtual ~ImmersiveModeControllerAsh(); 44 virtual ~ImmersiveModeControllerAsh();
42 45
43 // These methods are used to increment and decrement |revealed_lock_count_|. 46 // These methods are used to increment and decrement |revealed_lock_count_|.
44 // If immersive mode is enabled, a transition from 1 to 0 in 47 // If immersive mode is enabled, a transition from 1 to 0 in
(...skipping 13 matching lines...) Expand all
58 virtual bool ShouldHideTopViews() const OVERRIDE; 61 virtual bool ShouldHideTopViews() const OVERRIDE;
59 virtual bool IsRevealed() const OVERRIDE; 62 virtual bool IsRevealed() const OVERRIDE;
60 virtual void MaybeStackViewAtTop() OVERRIDE; 63 virtual void MaybeStackViewAtTop() OVERRIDE;
61 virtual ImmersiveModeController::RevealedLock* 64 virtual ImmersiveModeController::RevealedLock*
62 GetRevealedLock() OVERRIDE WARN_UNUSED_RESULT; 65 GetRevealedLock() OVERRIDE WARN_UNUSED_RESULT;
63 virtual void AnchorWidgetToTopContainer(views::Widget* widget, 66 virtual void AnchorWidgetToTopContainer(views::Widget* widget,
64 int y_offset) OVERRIDE; 67 int y_offset) OVERRIDE;
65 virtual void UnanchorWidgetFromTopContainer(views::Widget* widget) OVERRIDE; 68 virtual void UnanchorWidgetFromTopContainer(views::Widget* widget) OVERRIDE;
66 virtual void OnTopContainerBoundsChanged() OVERRIDE; 69 virtual void OnTopContainerBoundsChanged() OVERRIDE;
67 70
71 // content::NotificationObserver override:
72 virtual void Observe(int type,
73 const content::NotificationSource& source,
74 const content::NotificationDetails& details) OVERRIDE;
75
68 // ui::EventHandler overrides: 76 // ui::EventHandler overrides:
69 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; 77 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
70 78
71 // views::FocusChangeObserver overrides: 79 // views::FocusChangeObserver overrides:
72 virtual void OnWillChangeFocus(views::View* focused_before, 80 virtual void OnWillChangeFocus(views::View* focused_before,
73 views::View* focused_now) OVERRIDE; 81 views::View* focused_now) OVERRIDE;
74 virtual void OnDidChangeFocus(views::View* focused_before, 82 virtual void OnDidChangeFocus(views::View* focused_before,
75 views::View* focused_now) OVERRIDE; 83 views::View* focused_now) OVERRIDE;
76 84
77 // views::WidgetObserver overrides: 85 // views::WidgetObserver overrides:
78 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; 86 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
79 virtual void OnWidgetActivationChanged(views::Widget* widget, 87 virtual void OnWidgetActivationChanged(views::Widget* widget,
80 bool active) OVERRIDE; 88 bool active) OVERRIDE;
81 89
82 // ui::ImplicitAnimationObserver override: 90 // ui::ImplicitAnimationObserver override:
83 virtual void OnImplicitAnimationsCompleted() OVERRIDE; 91 virtual void OnImplicitAnimationsCompleted() OVERRIDE;
84 92
85 // Testing interface. 93 // Testing interface.
86 void SetHideTabIndicatorsForTest(bool hide); 94 void SetForceHideTabIndicatorsForTest(bool force);
87 void StartRevealForTest(bool hovered); 95 void StartRevealForTest(bool hovered);
88 void SetMouseHoveredForTest(bool hovered); 96 void SetMouseHoveredForTest(bool hovered);
89 97
90 private: 98 private:
91 enum Animate { 99 enum Animate {
92 ANIMATE_NO, 100 ANIMATE_NO,
93 ANIMATE_SLOW, 101 ANIMATE_SLOW,
94 ANIMATE_FAST, 102 ANIMATE_FAST,
95 }; 103 };
104 enum Layout {
105 LAYOUT_YES,
106 LAYOUT_NO
107 };
96 enum RevealState { 108 enum RevealState {
97 CLOSED, // Top container only showing tabstrip, y = 0. 109 CLOSED, // Top container only showing tabstrip, y = 0.
98 SLIDING_OPEN, // All views showing, y animating from -height to 0. 110 SLIDING_OPEN, // All views showing, y animating from -height to 0.
99 REVEALED, // All views showing, y = 0. 111 REVEALED, // All views showing, y = 0.
100 SLIDING_CLOSED, // All views showing, y animating from 0 to -height. 112 SLIDING_CLOSED, // All views showing, y animating from 0 to -height.
101 }; 113 };
114 enum TabIndicatorVisibility {
115 TAB_INDICATORS_FORCE_HIDE,
116 TAB_INDICATORS_HIDE,
117 TAB_INDICATORS_SHOW
118 };
102 119
103 // Enables or disables observers for mouse move, focus, and window restore. 120 // Enables or disables observers for mouse move, focus, and window restore.
104 void EnableWindowObservers(bool enable); 121 void EnableWindowObservers(bool enable);
105 122
106 // Update |mouse_revealed_lock_| based on the current mouse state and the 123 // Update |mouse_revealed_lock_| based on the current mouse state and the
107 // currently active widget. 124 // currently active widget.
108 // |maybe_drag| is true if the user may be in the middle of a drag. 125 // |maybe_drag| is true if the user may be in the middle of a drag.
109 void UpdateMouseRevealedLock(bool maybe_drag); 126 void UpdateMouseRevealedLock(bool maybe_drag);
110 127
111 // Acquire the mouse revealed lock if it is not already held. 128 // Acquire the mouse revealed lock if it is not already held.
112 void AcquireMouseRevealedLock(); 129 void AcquireMouseRevealedLock();
113 130
114 // Update |focus_revealed_lock_| based on the currently active view and the 131 // Update |focus_revealed_lock_| based on the currently active view and the
115 // currently active widget. 132 // currently active widget.
116 void UpdateFocusRevealedLock(); 133 void UpdateFocusRevealedLock();
117 134
135 // Updates whether fullscreen uses any chrome at all. When using minimal
136 // chrome, a 'light bar' is permanently visible for the launcher and possibly
137 // for the tabstrip.
138 void UpdateUseMinimalChrome(Layout layout);
139
118 // Returns the animation duration given |animate|. 140 // Returns the animation duration given |animate|.
119 int GetAnimationDuration(Animate animate) const; 141 int GetAnimationDuration(Animate animate) const;
120 142
121 // Temporarily reveals the top-of-window views while in immersive mode, 143 // Temporarily reveals the top-of-window views while in immersive mode,
122 // hiding them when the cursor exits the area of the top views. If |animate| 144 // hiding them when the cursor exits the area of the top views. If |animate|
123 // is not ANIMATE_NO, slides in the view, otherwise shows it immediately. 145 // is not ANIMATE_NO, slides in the view, otherwise shows it immediately.
124 void MaybeStartReveal(Animate animate); 146 void MaybeStartReveal(Animate animate);
125 147
126 // Enables or disables layer-based painting to allow smooth animations. 148 // Enables or disables layer-based painting to allow smooth animations.
127 void EnablePaintToLayer(bool enable); 149 void EnablePaintToLayer(bool enable);
(...skipping 29 matching lines...) Expand all
157 BrowserView* browser_view_; 179 BrowserView* browser_view_;
158 180
159 // True when in immersive mode. 181 // True when in immersive mode.
160 bool enabled_; 182 bool enabled_;
161 183
162 // State machine for the revealed/closed animations. 184 // State machine for the revealed/closed animations.
163 RevealState reveal_state_; 185 RevealState reveal_state_;
164 186
165 int revealed_lock_count_; 187 int revealed_lock_count_;
166 188
167 // True if the miniature "tab indicators" should be hidden in the main browser 189 // The visibility of the miniature "tab indicators" in the main browser view
168 // view when immersive mode is enabled. 190 // when immersive mode is enabled and the top-of-window views are closed.
169 bool hide_tab_indicators_; 191 TabIndicatorVisibility tab_indicator_visibility_;
170 192
171 // Timer to track cursor being held at the top. 193 // Timer to track cursor being held at the top.
172 base::OneShotTimer<ImmersiveModeController> top_timer_; 194 base::OneShotTimer<ImmersiveModeController> top_timer_;
173 195
174 // Lock which keeps the top-of-window views revealed based on the current 196 // Lock which keeps the top-of-window views revealed based on the current
175 // mouse state. 197 // mouse state.
176 scoped_ptr<RevealedLock> mouse_revealed_lock_; 198 scoped_ptr<RevealedLock> mouse_revealed_lock_;
177 199
178 // Lock which keeps the top-of-window views revealed based on the focused view 200 // Lock which keeps the top-of-window views revealed based on the focused view
179 // and the active widget. 201 // and the active widget.
180 scoped_ptr<RevealedLock> focus_revealed_lock_; 202 scoped_ptr<RevealedLock> focus_revealed_lock_;
181 203
182 // Native window for the browser, needed to clean up observers. 204 // Native window for the browser, needed to clean up observers.
183 aura::Window* native_window_; 205 aura::Window* native_window_;
184 206
185 // Observer to disable immersive mode when window leaves the maximized state. 207 // Observer to disable immersive mode when window leaves the maximized state.
186 class WindowObserver; 208 class WindowObserver;
187 scoped_ptr<WindowObserver> window_observer_; 209 scoped_ptr<WindowObserver> window_observer_;
188 210
189 // Manages widgets which are anchored to the top-of-window views. 211 // Manages widgets which are anchored to the top-of-window views.
190 class AnchoredWidgetManager; 212 class AnchoredWidgetManager;
191 scoped_ptr<AnchoredWidgetManager> anchored_widget_manager_; 213 scoped_ptr<AnchoredWidgetManager> anchored_widget_manager_;
192 214
215 content::NotificationRegistrar registrar_;
216
193 base::WeakPtrFactory<ImmersiveModeControllerAsh> weak_ptr_factory_; 217 base::WeakPtrFactory<ImmersiveModeControllerAsh> weak_ptr_factory_;
194 218
195 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeControllerAsh); 219 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeControllerAsh);
196 }; 220 };
197 221
198 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_ 222 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698