| 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/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // aura::WindowObserver overrides: | 103 // aura::WindowObserver overrides: |
| 104 virtual void OnWindowPropertyChanged(aura::Window* window, | 104 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 105 const void* key, | 105 const void* key, |
| 106 intptr_t old) OVERRIDE; | 106 intptr_t old) OVERRIDE; |
| 107 virtual void OnAddTransientChild(aura::Window* window, | 107 virtual void OnAddTransientChild(aura::Window* window, |
| 108 aura::Window* transient) OVERRIDE; | 108 aura::Window* transient) OVERRIDE; |
| 109 virtual void OnRemoveTransientChild(aura::Window* window, | 109 virtual void OnRemoveTransientChild(aura::Window* window, |
| 110 aura::Window* transient) OVERRIDE; | 110 aura::Window* transient) OVERRIDE; |
| 111 | 111 |
| 112 // Testing interface. | 112 // Testing interface. |
| 113 void SetForceHideTabIndicatorsForTest(bool force); | |
| 114 void StartRevealForTest(bool hovered); | 113 void StartRevealForTest(bool hovered); |
| 115 void SetMouseHoveredForTest(bool hovered); | 114 void SetMouseHoveredForTest(bool hovered); |
| 116 void DisableAnimationsForTest(); | 115 void DisableAnimationsForTest(); |
| 117 | 116 |
| 118 private: | 117 private: |
| 119 friend class ImmersiveModeControllerAshTest; | 118 friend class ImmersiveModeControllerAshTest; |
| 120 | 119 |
| 121 enum AllowRevealWhileClosing { | 120 enum AllowRevealWhileClosing { |
| 122 ALLOW_REVEAL_WHILE_CLOSING_YES, | 121 ALLOW_REVEAL_WHILE_CLOSING_YES, |
| 123 ALLOW_REVEAL_WHILE_CLOSING_NO | 122 ALLOW_REVEAL_WHILE_CLOSING_NO |
| 124 }; | 123 }; |
| 125 enum Animate { | 124 enum Animate { |
| 126 ANIMATE_NO, | 125 ANIMATE_NO, |
| 127 ANIMATE_SLOW, | 126 ANIMATE_SLOW, |
| 128 ANIMATE_FAST, | 127 ANIMATE_FAST, |
| 129 }; | 128 }; |
| 130 enum Layout { | 129 enum Layout { |
| 131 LAYOUT_YES, | 130 LAYOUT_YES, |
| 132 LAYOUT_NO | 131 LAYOUT_NO |
| 133 }; | 132 }; |
| 134 enum RevealState { | 133 enum RevealState { |
| 135 CLOSED, // Top container only showing tabstrip, y = 0. | 134 CLOSED, // Top container only showing tabstrip, y = 0. |
| 136 SLIDING_OPEN, // All views showing, y animating from -height to 0. | 135 SLIDING_OPEN, // All views showing, y animating from -height to 0. |
| 137 REVEALED, // All views showing, y = 0. | 136 REVEALED, // All views showing, y = 0. |
| 138 SLIDING_CLOSED, // All views showing, y animating from 0 to -height. | 137 SLIDING_CLOSED, // All views showing, y animating from 0 to -height. |
| 139 }; | 138 }; |
| 140 enum TabIndicatorVisibility { | |
| 141 TAB_INDICATORS_FORCE_HIDE, | |
| 142 TAB_INDICATORS_HIDE, | |
| 143 TAB_INDICATORS_SHOW | |
| 144 }; | |
| 145 enum SwipeType { | 139 enum SwipeType { |
| 146 SWIPE_OPEN, | 140 SWIPE_OPEN, |
| 147 SWIPE_CLOSE, | 141 SWIPE_CLOSE, |
| 148 SWIPE_NONE | 142 SWIPE_NONE |
| 149 }; | 143 }; |
| 150 | 144 |
| 151 // Enables or disables observers for mouse move, focus, and window restore. | 145 // Enables or disables observers for mouse move, focus, and window restore. |
| 152 void EnableWindowObservers(bool enable); | 146 void EnableWindowObservers(bool enable); |
| 153 | 147 |
| 154 // Updates |top_edge_hover_timer_| based on a mouse |event|. If the mouse is | 148 // Updates |top_edge_hover_timer_| based on a mouse |event|. If the mouse is |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // the top container is closed "near" means either within the displayed | 225 // the top container is closed "near" means either within the displayed |
| 232 // bounds, above it, or within a few pixels below it. This allow the container | 226 // bounds, above it, or within a few pixels below it. This allow the container |
| 233 // to steal enough pixels to detect a swipe in and handles the case that there | 227 // to steal enough pixels to detect a swipe in and handles the case that there |
| 234 // is a bezel sensor above the top container. | 228 // is a bezel sensor above the top container. |
| 235 bool ShouldHandleGestureEvent(const gfx::Point& location) const; | 229 bool ShouldHandleGestureEvent(const gfx::Point& location) const; |
| 236 | 230 |
| 237 // Recreate |bubble_manager_| and start observing any bubbles anchored to a | 231 // Recreate |bubble_manager_| and start observing any bubbles anchored to a |
| 238 // child of |top_container_|. | 232 // child of |top_container_|. |
| 239 void RecreateBubbleManager(); | 233 void RecreateBubbleManager(); |
| 240 | 234 |
| 241 // Shrinks or expands the touch hit test by updating insets for the render | |
| 242 // window depending on if top_inset is positive or negative respectively. | |
| 243 // Used to ensure that touch events at the top of the screen go to the top | |
| 244 // container so a slide gesture can be generated when the content window is | |
| 245 // consuming all touch events sent to it. | |
| 246 void SetRenderWindowTopInsetsForTouch(int top_inset); | |
| 247 | |
| 248 // Injected dependencies. Not owned. | 235 // Injected dependencies. Not owned. |
| 249 Delegate* delegate_; | 236 Delegate* delegate_; |
| 250 views::Widget* widget_; | 237 views::Widget* widget_; |
| 251 views::View* top_container_; | 238 views::View* top_container_; |
| 252 | 239 |
| 253 // True if the window observers are enabled. | 240 // True if the window observers are enabled. |
| 254 bool observers_enabled_; | 241 bool observers_enabled_; |
| 255 | 242 |
| 256 // True when in immersive mode. | 243 // True when in immersive mode. |
| 257 bool enabled_; | 244 bool enabled_; |
| 258 | 245 |
| 259 // State machine for the revealed/closed animations. | 246 // State machine for the revealed/closed animations. |
| 260 RevealState reveal_state_; | 247 RevealState reveal_state_; |
| 261 | 248 |
| 262 int revealed_lock_count_; | 249 int revealed_lock_count_; |
| 263 | 250 |
| 264 // The visibility of the miniature "tab indicators" in the main browser view | |
| 265 // when immersive mode is enabled and the top-of-window views are closed. | |
| 266 TabIndicatorVisibility tab_indicator_visibility_; | |
| 267 | |
| 268 // Timer to track cursor being held at the top edge of the screen. | 251 // Timer to track cursor being held at the top edge of the screen. |
| 269 base::OneShotTimer<ImmersiveModeController> top_edge_hover_timer_; | 252 base::OneShotTimer<ImmersiveModeController> top_edge_hover_timer_; |
| 270 | 253 |
| 271 // The cursor x position in screen coordinates when the cursor first hit the | 254 // The cursor x position in screen coordinates when the cursor first hit the |
| 272 // top edge of the screen. | 255 // top edge of the screen. |
| 273 int mouse_x_when_hit_top_in_screen_; | 256 int mouse_x_when_hit_top_in_screen_; |
| 274 | 257 |
| 275 // Tracks if the controller has seen a ET_GESTURE_SCROLL_BEGIN, without the | 258 // Tracks if the controller has seen a ET_GESTURE_SCROLL_BEGIN, without the |
| 276 // following events. | 259 // following events. |
| 277 bool gesture_begun_; | 260 bool gesture_begun_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 305 scoped_ptr<BubbleManager> bubble_manager_; | 288 scoped_ptr<BubbleManager> bubble_manager_; |
| 306 | 289 |
| 307 content::NotificationRegistrar registrar_; | 290 content::NotificationRegistrar registrar_; |
| 308 | 291 |
| 309 base::WeakPtrFactory<ImmersiveModeControllerAsh> weak_ptr_factory_; | 292 base::WeakPtrFactory<ImmersiveModeControllerAsh> weak_ptr_factory_; |
| 310 | 293 |
| 311 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeControllerAsh); | 294 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeControllerAsh); |
| 312 }; | 295 }; |
| 313 | 296 |
| 314 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_ | 297 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_ASH_H_ |
| OLD | NEW |