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_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/observer_list.h" | |
10 #include "base/timer.h" | 11 #include "base/timer.h" |
11 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
13 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
14 #include "ui/base/animation/animation_delegate.h" | 15 #include "ui/base/animation/animation_delegate.h" |
15 #include "ui/base/events/event_handler.h" | 16 #include "ui/base/events/event_handler.h" |
16 #include "ui/views/focus/focus_manager.h" | 17 #include "ui/views/focus/focus_manager.h" |
17 #include "ui/views/widget/widget_observer.h" | 18 #include "ui/views/widget/widget_observer.h" |
18 | 19 |
19 class BrowserView; | 20 class BrowserView; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 virtual bool ShouldHideTopViews() const OVERRIDE; | 69 virtual bool ShouldHideTopViews() const OVERRIDE; |
69 virtual bool IsRevealed() const OVERRIDE; | 70 virtual bool IsRevealed() const OVERRIDE; |
70 virtual int GetTopContainerVerticalOffset( | 71 virtual int GetTopContainerVerticalOffset( |
71 const gfx::Size& top_container_size) const OVERRIDE; | 72 const gfx::Size& top_container_size) const OVERRIDE; |
72 virtual ImmersiveRevealedLock* GetRevealedLock( | 73 virtual ImmersiveRevealedLock* GetRevealedLock( |
73 AnimateReveal animate_reveal) OVERRIDE WARN_UNUSED_RESULT; | 74 AnimateReveal animate_reveal) OVERRIDE WARN_UNUSED_RESULT; |
74 virtual void AnchorWidgetToTopContainer(views::Widget* widget, | 75 virtual void AnchorWidgetToTopContainer(views::Widget* widget, |
75 int y_offset) OVERRIDE; | 76 int y_offset) OVERRIDE; |
76 virtual void UnanchorWidgetFromTopContainer(views::Widget* widget) OVERRIDE; | 77 virtual void UnanchorWidgetFromTopContainer(views::Widget* widget) OVERRIDE; |
77 virtual void OnTopContainerBoundsChanged() OVERRIDE; | 78 virtual void OnTopContainerBoundsChanged() OVERRIDE; |
79 virtual void AddObserver(Observer* observer) OVERRIDE; | |
80 virtual void RemoveObserver(Observer* observer) OVERRIDE; | |
78 | 81 |
79 // content::NotificationObserver override: | 82 // content::NotificationObserver override: |
80 virtual void Observe(int type, | 83 virtual void Observe(int type, |
81 const content::NotificationSource& source, | 84 const content::NotificationSource& source, |
82 const content::NotificationDetails& details) OVERRIDE; | 85 const content::NotificationDetails& details) OVERRIDE; |
83 | 86 |
84 // ui::EventHandler overrides: | 87 // ui::EventHandler overrides: |
85 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 88 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
86 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; | 89 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; |
87 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 90 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 // when immersive mode is enabled and the top-of-window views are closed. | 245 // when immersive mode is enabled and the top-of-window views are closed. |
243 TabIndicatorVisibility tab_indicator_visibility_; | 246 TabIndicatorVisibility tab_indicator_visibility_; |
244 | 247 |
245 // Timer to track cursor being held at the top edge of the screen. | 248 // Timer to track cursor being held at the top edge of the screen. |
246 base::OneShotTimer<ImmersiveModeController> top_edge_hover_timer_; | 249 base::OneShotTimer<ImmersiveModeController> top_edge_hover_timer_; |
247 | 250 |
248 // The cursor x position in root coordinates when the cursor first hit | 251 // The cursor x position in root coordinates when the cursor first hit |
249 // the top edge of the screen. | 252 // the top edge of the screen. |
250 int mouse_x_when_hit_top_; | 253 int mouse_x_when_hit_top_; |
251 | 254 |
255 // Tracks if the controller has seen a ET_GESTURE_SCROLL_BEGIN, without the | |
256 // following events. | |
257 bool gesture_begun_; | |
258 | |
252 // Lock which keeps the top-of-window views revealed based on the current | 259 // Lock which keeps the top-of-window views revealed based on the current |
253 // mouse state and the current touch state. Acquiring the lock is used to | 260 // mouse state and the current touch state. Acquiring the lock is used to |
254 // trigger a reveal when the user moves the mouse to the top of the screen | 261 // trigger a reveal when the user moves the mouse to the top of the screen |
255 // and when the user does a SWIPE_OPEN edge gesture. | 262 // and when the user does a SWIPE_OPEN edge gesture. |
256 scoped_ptr<ImmersiveRevealedLock> located_event_revealed_lock_; | 263 scoped_ptr<ImmersiveRevealedLock> located_event_revealed_lock_; |
257 | 264 |
258 // Lock which keeps the top-of-window views revealed based on the focused view | 265 // Lock which keeps the top-of-window views revealed based on the focused view |
259 // and the active widget. Acquiring the lock never triggers a reveal because | 266 // and the active widget. Acquiring the lock never triggers a reveal because |
260 // a view is not focusable till a reveal has made it visible. | 267 // a view is not focusable till a reveal has made it visible. |
261 scoped_ptr<ImmersiveRevealedLock> focus_revealed_lock_; | 268 scoped_ptr<ImmersiveRevealedLock> focus_revealed_lock_; |
262 | 269 |
263 // Native window for the browser. | 270 // Native window for the browser. |
264 aura::Window* native_window_; | 271 aura::Window* native_window_; |
265 | 272 |
266 // The animation which controls sliding the top-of-window views in and out. | 273 // The animation which controls sliding the top-of-window views in and out. |
267 scoped_ptr<ui::SlideAnimation> animation_; | 274 scoped_ptr<ui::SlideAnimation> animation_; |
268 | 275 |
269 // Whether the animations are disabled for testing. | 276 // Whether the animations are disabled for testing. |
270 bool animations_disabled_for_test_; | 277 bool animations_disabled_for_test_; |
271 | 278 |
272 // Manages widgets which are anchored to the top-of-window views. | 279 // Manages widgets which are anchored to the top-of-window views. |
273 class AnchoredWidgetManager; | 280 class AnchoredWidgetManager; |
274 scoped_ptr<AnchoredWidgetManager> anchored_widget_manager_; | 281 scoped_ptr<AnchoredWidgetManager> anchored_widget_manager_; |
275 | 282 |
283 ObserverList<Observer> observers_; | |
284 | |
276 content::NotificationRegistrar registrar_; | 285 content::NotificationRegistrar registrar_; |
277 | 286 |
278 base::WeakPtrFactory<ImmersiveModeControllerAsh> weak_ptr_factory_; | 287 base::WeakPtrFactory<ImmersiveModeControllerAsh> weak_ptr_factory_; |
James Cook
2013/06/17 16:13:41
Good catch that weak_prt_factory_ should be last.
| |
279 | 288 |
280 // Tracks if the controller has seen a ET_GESTURE_SCROLL_BEGIN, without the | |
281 // following events. | |
282 bool gesture_begun_; | |
283 | |
284 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeControllerAsh); | 289 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeControllerAsh); |
285 }; | 290 }; |
286 | 291 |
287 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_ | 292 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_ |
OLD | NEW |