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 "ash/wm/splitview/split_view_controller.h" | |
12 #include "base/macros.h" | |
13 #include "ui/gfx/geometry/point.h" | |
14 | |
15 namespace ash { | |
16 | |
17 class PhantomWindowController; | |
18 class WindowSelector; | |
19 class WindowSelectorItem; | |
20 | |
21 // The drag controller for an overview window item in overview mode. It updates | |
22 // the position of the corresponding window item using transform while dragging | |
23 // and shows/hides the phantom window accordingly. | |
24 class ASH_EXPORT OverviewWindowDragController { | |
25 public: | |
26 explicit OverviewWindowDragController(WindowSelector* window_selector); | |
27 ~OverviewWindowDragController(); | |
28 | |
29 void InitiateDrag(WindowSelectorItem* item, | |
30 const gfx::Point& location_in_screen); | |
31 void Drag(const gfx::Point& location_in_screen); | |
32 void CompleteDrag(); | |
33 | |
34 WindowSelectorItem* item() { return item_; } | |
35 | |
36 private: | |
37 void UpdatePhantomWindow(const gfx::Point& location_in_screen); | |
38 | |
39 SplitViewController::SnapPosition GetSnapPosition( | |
40 const gfx::Point& location_in_screen); | |
oshima
2017/07/14 18:43:11
nit: const?
xdai1
2017/07/18 17:36:44
Done.
| |
41 | |
42 void SnapWindow(SplitViewController::SnapPosition snap_position); | |
43 | |
44 WindowSelector* window_selector_; | |
45 | |
46 SplitViewController* split_view_controller_; | |
47 | |
48 // Shows a highlight of where the dragged window will end up. | |
49 std::unique_ptr<PhantomWindowController> phantom_window_controller_; | |
50 | |
51 // The drag target window in the overview mode. | |
52 WindowSelectorItem* item_ = nullptr; | |
53 | |
54 // The location of the previous mouse/touch/gesture event in screen. | |
55 gfx::Point previous_event_location_; | |
56 | |
57 // Set to true once the bounds of |item_| change. | |
58 bool did_move_ = false; | |
59 | |
60 SplitViewController::SnapPosition snap_position_ = SplitViewController::NONE; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(OverviewWindowDragController); | |
63 }; | |
64 | |
65 } // namespace ash | |
66 | |
67 #endif // ASH_WM_OVERVIEW_OVERVIEW_WINDOW_DRAG_CONTROLLER_H_ | |
OLD | NEW |