Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: ash/wm/overview/overview_window_drag_controller.h

Issue 2918403006: CrOS Tablet Window management - Split Screen part I (Closed)
Patch Set: Address oshima@'s comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 SnapToLeft();
44 void SnapToRight();
45
46 WindowSelector* window_selector_;
47
48 SplitViewController* split_view_controller_;
49
50 // Gives a previews of where the dragged window will end up.
51 std::unique_ptr<PhantomWindowController> phantom_window_controller_;
52
53 // The drag target window in the overview mode.
54 WindowSelectorItem* item_ = nullptr;
55
56 // The location of the initial mouse/touch/gesture event in screen.
57 gfx::Point initial_event_location_;
varkha 2017/06/21 01:51:52 I suspect you could use previous_event_location_ f
xdai1 2017/06/22 21:46:33 You're right. Removed |initial_event_location_|. T
58
59 // The location of the previous mouse/touch/gesture event in screen.
60 gfx::Point previous_event_location_;
61
62 // Set to true once the bounds of |item_| changes.
63 bool did_move_ = false;
64
65 SnapType snap_type_ = SNAP_NONE;
66
67 DISALLOW_COPY_AND_ASSIGN(OverviewWindowDragController);
68 };
69
70 } // namespace ash
71
72 #endif // ASH_WM_OVERVIEW_OVERVIEW_WINDOW_DRAG_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698