| 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 ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| 6 #define ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 6 #define ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // Returns shelf visibility state based on current value of auto hide | 91 // Returns shelf visibility state based on current value of auto hide |
| 92 // behavior setting. | 92 // behavior setting. |
| 93 ShelfVisibilityState CalculateShelfVisibility(); | 93 ShelfVisibilityState CalculateShelfVisibility(); |
| 94 | 94 |
| 95 // Updates the visibility state. | 95 // Updates the visibility state. |
| 96 void UpdateVisibilityState(); | 96 void UpdateVisibilityState(); |
| 97 | 97 |
| 98 // Invoked by the shelf when the auto-hide state may have changed. | 98 // Invoked by the shelf when the auto-hide state may have changed. |
| 99 void UpdateAutoHideState(); | 99 void UpdateAutoHideState(); |
| 100 | 100 |
| 101 // Updates the auto-hide state for certain events. In classic ash these come | 101 // Updates the auto-hide state for certain events. |
| 102 // from an EventHandler. In mash these come from events that hit the shelf | 102 // TODO(mash): Add similar event handling support for mash. |
| 103 // widget and status tray widget. | 103 void UpdateAutoHideForMouseEvent(ui::MouseEvent* event, WmWindow* target); |
| 104 void UpdateAutoHideForMouseEvent(ui::MouseEvent* event); | 104 void UpdateAutoHideForGestureEvent(ui::GestureEvent* event, WmWindow* target); |
| 105 void UpdateAutoHideForGestureEvent(ui::GestureEvent* event); | |
| 106 | 105 |
| 107 ShelfVisibilityState visibility_state() const { | 106 ShelfVisibilityState visibility_state() const { |
| 108 return state_.visibility_state; | 107 return state_.visibility_state; |
| 109 } | 108 } |
| 110 ShelfAutoHideState auto_hide_state() const { return state_.auto_hide_state; } | 109 ShelfAutoHideState auto_hide_state() const { return state_.auto_hide_state; } |
| 111 | 110 |
| 112 ShelfWidget* shelf_widget() { return shelf_widget_; } | 111 ShelfWidget* shelf_widget() { return shelf_widget_; } |
| 113 | 112 |
| 114 // Sets whether any windows overlap the shelf. If a window overlaps the shelf | 113 // Sets whether any windows overlap the shelf. If a window overlaps the shelf |
| 115 // the shelf renders slightly differently. | 114 // the shelf renders slightly differently. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 bool IsHorizontalAlignment() const; | 180 bool IsHorizontalAlignment() const; |
| 182 | 181 |
| 183 // Returns how the shelf background is painted. | 182 // Returns how the shelf background is painted. |
| 184 ShelfBackgroundType GetShelfBackgroundType() const; | 183 ShelfBackgroundType GetShelfBackgroundType() const; |
| 185 | 184 |
| 186 // Set the height of the ChromeVox panel, which takes away space from the | 185 // Set the height of the ChromeVox panel, which takes away space from the |
| 187 // available work area from the top of the screen. | 186 // available work area from the top of the screen. |
| 188 void SetChromeVoxPanelHeight(int height); | 187 void SetChromeVoxPanelHeight(int height); |
| 189 | 188 |
| 190 private: | 189 private: |
| 191 class AutoHideEventFilter; | |
| 192 class RootWindowControllerObserverImpl; | 190 class RootWindowControllerObserverImpl; |
| 193 class UpdateShelfObserver; | 191 class UpdateShelfObserver; |
| 194 friend class PanelLayoutManagerTest; | 192 friend class PanelLayoutManagerTest; |
| 195 friend class ShelfLayoutManagerTest; | 193 friend class ShelfLayoutManagerTest; |
| 196 | 194 |
| 197 struct TargetBounds { | 195 struct TargetBounds { |
| 198 TargetBounds(); | 196 TargetBounds(); |
| 199 ~TargetBounds(); | 197 ~TargetBounds(); |
| 200 | 198 |
| 201 float opacity; | 199 float opacity; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 // when the shelf is auto hidden and the shelf is on the boundary between | 267 // when the shelf is auto hidden and the shelf is on the boundary between |
| 270 // two displays. | 268 // two displays. |
| 271 gfx::Rect GetAutoHideShowShelfRegionInScreen() const; | 269 gfx::Rect GetAutoHideShowShelfRegionInScreen() const; |
| 272 | 270 |
| 273 // Returns the AutoHideState. This value is determined from the shelf and | 271 // Returns the AutoHideState. This value is determined from the shelf and |
| 274 // tray. | 272 // tray. |
| 275 ShelfAutoHideState CalculateAutoHideState( | 273 ShelfAutoHideState CalculateAutoHideState( |
| 276 ShelfVisibilityState visibility_state) const; | 274 ShelfVisibilityState visibility_state) const; |
| 277 | 275 |
| 278 // Returns true if |window| is a descendant of the shelf. | 276 // Returns true if |window| is a descendant of the shelf. |
| 279 bool IsShelfWindow(aura::Window* window); | 277 bool IsShelfWindow(WmWindow* window); |
| 280 | 278 |
| 281 int GetWorkAreaInsets(const State& state, int size) const; | 279 int GetWorkAreaInsets(const State& state, int size) const; |
| 282 | 280 |
| 283 // Overridden from DockedWindowLayoutManagerObserver: | 281 // Overridden from DockedWindowLayoutManagerObserver: |
| 284 void OnDockBoundsChanging( | 282 void OnDockBoundsChanging( |
| 285 const gfx::Rect& dock_bounds, | 283 const gfx::Rect& dock_bounds, |
| 286 DockedWindowLayoutManagerObserver::Reason reason) override; | 284 DockedWindowLayoutManagerObserver::Reason reason) override; |
| 287 | 285 |
| 288 // Called when the LoginUI changes from visible to invisible. | 286 // Called when the LoginUI changes from visible to invisible. |
| 289 void UpdateShelfVisibilityAfterLoginUIChange(); | 287 void UpdateShelfVisibilityAfterLoginUIChange(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 300 void UpdateGestureDrag(const ui::GestureEvent& gesture); | 298 void UpdateGestureDrag(const ui::GestureEvent& gesture); |
| 301 void CompleteGestureDrag(const ui::GestureEvent& gesture); | 299 void CompleteGestureDrag(const ui::GestureEvent& gesture); |
| 302 void CancelGestureDrag(); | 300 void CancelGestureDrag(); |
| 303 | 301 |
| 304 // True when inside UpdateBoundsAndOpacity() method. Used to prevent calling | 302 // True when inside UpdateBoundsAndOpacity() method. Used to prevent calling |
| 305 // UpdateBoundsAndOpacity() again from SetChildBounds(). | 303 // UpdateBoundsAndOpacity() again from SetChildBounds(). |
| 306 bool updating_bounds_; | 304 bool updating_bounds_; |
| 307 | 305 |
| 308 bool in_shutdown_ = false; | 306 bool in_shutdown_ = false; |
| 309 | 307 |
| 308 // True if the last mouse event was a mouse drag. |
| 309 bool in_mouse_drag_ = false; |
| 310 |
| 310 // Current state. | 311 // Current state. |
| 311 State state_; | 312 State state_; |
| 312 | 313 |
| 313 ShelfWidget* shelf_widget_; | 314 ShelfWidget* shelf_widget_; |
| 314 | 315 |
| 315 WorkspaceController* workspace_controller_; | 316 WorkspaceController* workspace_controller_; |
| 316 | 317 |
| 317 // Do any windows overlap the shelf? This is maintained by WorkspaceManager. | 318 // Do any windows overlap the shelf? This is maintained by WorkspaceManager. |
| 318 bool window_overlaps_shelf_; | 319 bool window_overlaps_shelf_; |
| 319 | 320 |
| 320 base::OneShotTimer auto_hide_timer_; | 321 base::OneShotTimer auto_hide_timer_; |
| 321 | 322 |
| 322 // Whether the mouse was over the shelf when the auto hide timer started. | 323 // Whether the mouse was over the shelf when the auto hide timer started. |
| 323 // False when neither the auto hide timer nor the timer task are running. | 324 // False when neither the auto hide timer nor the timer task are running. |
| 324 bool mouse_over_shelf_when_auto_hide_timer_started_; | 325 bool mouse_over_shelf_when_auto_hide_timer_started_; |
| 325 | 326 |
| 326 // EventFilter used to detect when user moves the mouse over the shelf to | |
| 327 // trigger showing the shelf. Used in classic ash. | |
| 328 std::unique_ptr<AutoHideEventFilter> auto_hide_event_filter_; | |
| 329 | |
| 330 // EventFilter used to detect when user issues a gesture on a bezel sensor. | 327 // EventFilter used to detect when user issues a gesture on a bezel sensor. |
| 331 std::unique_ptr<ShelfBezelEventFilter> bezel_event_filter_; | 328 std::unique_ptr<ShelfBezelEventFilter> bezel_event_filter_; |
| 332 | 329 |
| 333 base::ObserverList<ShelfLayoutManagerObserver> observers_; | 330 base::ObserverList<ShelfLayoutManagerObserver> observers_; |
| 334 | 331 |
| 335 // The shelf reacts to gesture-drags, and can be set to auto-hide for certain | 332 // The shelf reacts to gesture-drags, and can be set to auto-hide for certain |
| 336 // gestures. Some shelf behaviour (e.g. visibility state, background color | 333 // gestures. Some shelf behaviour (e.g. visibility state, background color |
| 337 // etc.) are affected by various stages of the drag. The enum keeps track of | 334 // etc.) are affected by various stages of the drag. The enum keeps track of |
| 338 // the present status of the gesture drag. | 335 // the present status of the gesture drag. |
| 339 enum GestureDragStatus { | 336 enum GestureDragStatus { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 370 |
| 374 std::unique_ptr<RootWindowControllerObserverImpl> | 371 std::unique_ptr<RootWindowControllerObserverImpl> |
| 375 root_window_controller_observer_; | 372 root_window_controller_observer_; |
| 376 | 373 |
| 377 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 374 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 378 }; | 375 }; |
| 379 | 376 |
| 380 } // namespace ash | 377 } // namespace ash |
| 381 | 378 |
| 382 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 379 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |