OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ASH_WM_OVERVIEW_OVERVIEW_WINDOW_DRAG_CONTROLLER_H_ |
| 6 #define ASH_WM_OVERVIEW_OVERVIEW_WINDOW_DRAG_CONTROLLER_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "ash/ash_export.h" |
| 11 #include "base/macros.h" |
| 12 #include "ui/gfx/geometry/point.h" |
| 13 #include "ui/gfx/geometry/rect.h" |
| 14 |
| 15 namespace ash { |
| 16 |
| 17 class WindowSelector; |
| 18 class WindowSelectorItem; |
| 19 class PhantomWindowController; |
| 20 class SplitViewController; |
| 21 |
| 22 // The drag controller for an overview window item in overview mode. It updates |
| 23 // the position of the corresponding window item using transform while dragging |
| 24 // and shows/hides the phantom window accordingly. |
| 25 class ASH_EXPORT OverviewWindowDragController { |
| 26 public: |
| 27 explicit OverviewWindowDragController(WindowSelector* window_selector); |
| 28 ~OverviewWindowDragController(); |
| 29 |
| 30 void InitiateDrag(WindowSelectorItem* item, |
| 31 const gfx::Point& location_in_screen); |
| 32 void Drag(const gfx::Point& location_in_screen); |
| 33 void CompleteDrag(); |
| 34 |
| 35 WindowSelectorItem* item() { return item_; } |
| 36 |
| 37 private: |
| 38 enum SnapType { SNAP_LEFT, SNAP_RIGHT, SNAP_NONE }; |
| 39 |
| 40 void UpdatePhantomWindow(const gfx::Point& location_in_screen); |
| 41 SnapType GetSnapType(const gfx::Point& location_in_screen); |
| 42 |
| 43 void SnapWindow(SnapType snap_type); |
| 44 |
| 45 WindowSelector* window_selector_; |
| 46 |
| 47 SplitViewController* split_view_controller_; |
| 48 |
| 49 // Gives a previews of where the dragged window will end up. |
| 50 std::unique_ptr<PhantomWindowController> phantom_window_controller_; |
| 51 |
| 52 // The drag target window in the overview mode. |
| 53 WindowSelectorItem* item_ = nullptr; |
| 54 |
| 55 // The location of the previous mouse/touch/gesture event in screen. |
| 56 gfx::Point previous_event_location_; |
| 57 |
| 58 // Set to true once the bounds of |item_| changes. |
| 59 bool did_move_ = false; |
| 60 |
| 61 SnapType snap_type_ = SNAP_NONE; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(OverviewWindowDragController); |
| 64 }; |
| 65 |
| 66 } // namespace ash |
| 67 |
| 68 #endif // ASH_WM_OVERVIEW_OVERVIEW_WINDOW_DRAG_CONTROLLER_H_ |
OLD | NEW |