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 while dragging and shows/hides | |
oshima
2017/06/14 00:19:27
update the position using transform?
xdai1
2017/06/15 22:11:41
Done.
| |
24 // the phantom window accordingly. | |
25 class ASH_EXPORT OverviewWindowDragController { | |
26 public: | |
27 enum SnapType { SNAP_LEFT, SNAP_RIGHT, SNAP_NONE }; | |
oshima
2017/06/14 00:19:27
does this have to be public?
xdai1
2017/06/15 22:11:41
You're right. Not necessarily. Moved to private.
| |
28 | |
29 OverviewWindowDragController(WindowSelector* window_selector); | |
oshima
2017/06/14 00:19:27
explicit
xdai1
2017/06/15 22:11:41
Done.
| |
30 ~OverviewWindowDragController(); | |
31 | |
32 void InitiateDrag(WindowSelectorItem* item, | |
33 const gfx::Point& location_in_screen); | |
34 void Drag(WindowSelectorItem* item, const gfx::Point& location_in_screen); | |
35 void CompleteDrag(WindowSelectorItem* item); | |
36 | |
37 private: | |
38 void UpdatePhantomWindow(const gfx::Point& location_in_screen); | |
39 SnapType GetSnapType(const gfx::Point& location_in_screen); | |
40 | |
41 void SnapToLeft(); | |
42 void SnapToRight(); | |
43 | |
44 WindowSelector* window_selector_; | |
45 | |
46 SplitViewController* split_view_controller_; | |
47 | |
48 // Gives a previews 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 initial mouse/touch/gesture event in screen. | |
55 gfx::Point initial_event_location_; | |
56 | |
57 // The location of the previous mouse/touch/gesture event in screen. | |
58 gfx::Point previous_event_location_; | |
59 | |
60 // Set to true once the bounds of |item_| changes. | |
61 bool did_move_ = false; | |
62 | |
63 SnapType snap_type_ = SNAP_NONE; | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(OverviewWindowDragController); | |
66 }; | |
67 | |
68 } // namespace ash | |
69 | |
70 #endif // ASH_WM_OVERVIEW_OVERVIEW_WINDOW_DRAG_CONTROLLER_H_ | |
OLD | NEW |