| 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" |
| 11 #include "ash/common/session/session_state_observer.h" | 11 #include "ash/common/session/session_state_observer.h" |
| 12 #include "ash/common/shelf/shelf_types.h" | 12 #include "ash/common/shelf/shelf_types.h" |
| 13 #include "ash/common/shell_observer.h" | 13 #include "ash/common/shell_observer.h" |
| 14 #include "ash/common/wm/background_animator.h" | 14 #include "ash/common/wm/background_animator.h" |
| 15 #include "ash/common/wm/dock/docked_window_layout_manager_observer.h" | 15 #include "ash/common/wm/dock/docked_window_layout_manager_observer.h" |
| 16 #include "ash/common/wm/lock_state_observer.h" | 16 #include "ash/common/wm/lock_state_observer.h" |
| 17 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" | 17 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" |
| 18 #include "ash/common/wm/workspace/workspace_types.h" | 18 #include "ash/common/wm/workspace/workspace_types.h" |
| 19 #include "ash/common/wm_activation_observer.h" | 19 #include "ash/common/wm_activation_observer.h" |
| 20 #include "ash/shelf/shelf_widget.h" | 20 #include "ash/shelf/shelf_widget.h" |
| 21 #include "ash/wm/gestures/shelf_gesture_handler.h" | |
| 22 #include "base/macros.h" | 21 #include "base/macros.h" |
| 23 #include "base/observer_list.h" | 22 #include "base/observer_list.h" |
| 24 #include "base/timer/timer.h" | 23 #include "base/timer/timer.h" |
| 25 #include "ui/gfx/geometry/insets.h" | 24 #include "ui/gfx/geometry/insets.h" |
| 26 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 27 #include "ui/keyboard/keyboard_controller_observer.h" | 26 #include "ui/keyboard/keyboard_controller_observer.h" |
| 28 | 27 |
| 29 namespace ui { | 28 namespace ui { |
| 30 class ImplicitAnimationObserver; | 29 class ImplicitAnimationObserver; |
| 31 } | 30 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 ShelfWidget* shelf_widget() { return shelf_widget_; } | 112 ShelfWidget* shelf_widget() { return shelf_widget_; } |
| 114 | 113 |
| 115 // Sets whether any windows overlap the shelf. If a window overlaps the shelf | 114 // Sets whether any windows overlap the shelf. If a window overlaps the shelf |
| 116 // the shelf renders slightly differently. | 115 // the shelf renders slightly differently. |
| 117 void SetWindowOverlapsShelf(bool value); | 116 void SetWindowOverlapsShelf(bool value); |
| 118 bool window_overlaps_shelf() const { return window_overlaps_shelf_; } | 117 bool window_overlaps_shelf() const { return window_overlaps_shelf_; } |
| 119 | 118 |
| 120 void AddObserver(ShelfLayoutManagerObserver* observer); | 119 void AddObserver(ShelfLayoutManagerObserver* observer); |
| 121 void RemoveObserver(ShelfLayoutManagerObserver* observer); | 120 void RemoveObserver(ShelfLayoutManagerObserver* observer); |
| 122 | 121 |
| 123 // Gesture related functions: | 122 // Processes a gesture event and updates the status of the shelf when |
| 124 void OnGestureEdgeSwipe(const ui::GestureEvent& gesture); | 123 // appropriate. Returns true if the gesture has been handled and it should not |
| 125 void StartGestureDrag(const ui::GestureEvent& gesture); | 124 // be processed any further, false otherwise. |
| 126 void UpdateGestureDrag(const ui::GestureEvent& gesture); | 125 bool ProcessGestureEvent(const ui::GestureEvent& event); |
| 127 void CompleteGestureDrag(const ui::GestureEvent& gesture); | |
| 128 void CancelGestureDrag(); | |
| 129 | 126 |
| 130 // Set an animation duration override for the show / hide animation of the | 127 // Set an animation duration override for the show / hide animation of the |
| 131 // shelf. Specifying 0 leads to use the default. | 128 // shelf. Specifying 0 leads to use the default. |
| 132 void SetAnimationDurationOverride(int duration_override_in_ms); | 129 void SetAnimationDurationOverride(int duration_override_in_ms); |
| 133 | 130 |
| 134 // Overridden from wm::WmSnapToPixelLayoutManager: | 131 // Overridden from wm::WmSnapToPixelLayoutManager: |
| 135 void OnWindowResized() override; | 132 void OnWindowResized() override; |
| 136 void SetChildBounds(WmWindow* child, | 133 void SetChildBounds(WmWindow* child, |
| 137 const gfx::Rect& requested_bounds) override; | 134 const gfx::Rect& requested_bounds) override; |
| 138 | 135 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 void OnDockBoundsChanging( | 284 void OnDockBoundsChanging( |
| 288 const gfx::Rect& dock_bounds, | 285 const gfx::Rect& dock_bounds, |
| 289 DockedWindowLayoutManagerObserver::Reason reason) override; | 286 DockedWindowLayoutManagerObserver::Reason reason) override; |
| 290 | 287 |
| 291 // Called when the LoginUI changes from visible to invisible. | 288 // Called when the LoginUI changes from visible to invisible. |
| 292 void UpdateShelfVisibilityAfterLoginUIChange(); | 289 void UpdateShelfVisibilityAfterLoginUIChange(); |
| 293 | 290 |
| 294 // Compute |target_bounds| opacity based on gesture and shelf visibility. | 291 // Compute |target_bounds| opacity based on gesture and shelf visibility. |
| 295 float ComputeTargetOpacity(const State& state); | 292 float ComputeTargetOpacity(const State& state); |
| 296 | 293 |
| 294 // Returns true if there is a fullscreen window open that causes the shelf |
| 295 // to be hidden. |
| 296 bool IsShelfHiddenForFullscreen() const; |
| 297 |
| 298 // Gesture related functions: |
| 299 void StartGestureDrag(const ui::GestureEvent& gesture); |
| 300 void UpdateGestureDrag(const ui::GestureEvent& gesture); |
| 301 void CompleteGestureDrag(const ui::GestureEvent& gesture); |
| 302 void CancelGestureDrag(); |
| 303 |
| 297 // The RootWindow is cached so that we don't invoke Shell::GetInstance() from | 304 // The RootWindow is cached so that we don't invoke Shell::GetInstance() from |
| 298 // our destructor. We avoid that as at the time we're deleted Shell is being | 305 // our destructor. We avoid that as at the time we're deleted Shell is being |
| 299 // deleted too. | 306 // deleted too. |
| 300 aura::Window* root_window_; | 307 aura::Window* root_window_; |
| 301 | 308 |
| 302 // True when inside UpdateBoundsAndOpacity() method. Used to prevent calling | 309 // True when inside UpdateBoundsAndOpacity() method. Used to prevent calling |
| 303 // UpdateBoundsAndOpacity() again from SetChildBounds(). | 310 // UpdateBoundsAndOpacity() again from SetChildBounds(). |
| 304 bool updating_bounds_; | 311 bool updating_bounds_; |
| 305 | 312 |
| 306 bool in_shutdown_ = false; | 313 bool in_shutdown_ = false; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 323 | 330 |
| 324 // EventFilter used to detect when user moves the mouse over the shelf to | 331 // EventFilter used to detect when user moves the mouse over the shelf to |
| 325 // trigger showing the shelf. Used in classic ash. | 332 // trigger showing the shelf. Used in classic ash. |
| 326 std::unique_ptr<AutoHideEventFilter> auto_hide_event_filter_; | 333 std::unique_ptr<AutoHideEventFilter> auto_hide_event_filter_; |
| 327 | 334 |
| 328 // EventFilter used to detect when user issues a gesture on a bezel sensor. | 335 // EventFilter used to detect when user issues a gesture on a bezel sensor. |
| 329 std::unique_ptr<ShelfBezelEventFilter> bezel_event_filter_; | 336 std::unique_ptr<ShelfBezelEventFilter> bezel_event_filter_; |
| 330 | 337 |
| 331 base::ObserverList<ShelfLayoutManagerObserver> observers_; | 338 base::ObserverList<ShelfLayoutManagerObserver> observers_; |
| 332 | 339 |
| 333 ShelfGestureHandler gesture_handler_; | |
| 334 | |
| 335 // The shelf reacts to gesture-drags, and can be set to auto-hide for certain | 340 // 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 | 341 // 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 | 342 // etc.) are affected by various stages of the drag. The enum keeps track of |
| 338 // the present status of the gesture drag. | 343 // the present status of the gesture drag. |
| 339 enum GestureDragStatus { | 344 enum GestureDragStatus { |
| 340 GESTURE_DRAG_NONE, | 345 GESTURE_DRAG_NONE, |
| 341 GESTURE_DRAG_IN_PROGRESS, | 346 GESTURE_DRAG_IN_PROGRESS, |
| 342 GESTURE_DRAG_CANCEL_IN_PROGRESS, | 347 GESTURE_DRAG_CANCEL_IN_PROGRESS, |
| 343 GESTURE_DRAG_COMPLETE_IN_PROGRESS | 348 GESTURE_DRAG_COMPLETE_IN_PROGRESS |
| 344 }; | 349 }; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 373 | 378 |
| 374 std::unique_ptr<RootWindowControllerObserverImpl> | 379 std::unique_ptr<RootWindowControllerObserverImpl> |
| 375 root_window_controller_observer_; | 380 root_window_controller_observer_; |
| 376 | 381 |
| 377 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); | 382 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); |
| 378 }; | 383 }; |
| 379 | 384 |
| 380 } // namespace ash | 385 } // namespace ash |
| 381 | 386 |
| 382 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ | 387 #endif // ASH_SHELF_SHELF_LAYOUT_MANAGER_H_ |
| OLD | NEW |