OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H | 5 #ifndef ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H |
6 #define ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H | 6 #define ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H |
7 | 7 |
8 #include "ash/display/mouse_warp_controller.h" | 8 #include "ash/display/mouse_warp_controller.h" |
9 | 9 |
| 10 #include <memory> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
16 | 16 |
17 namespace aura { | 17 namespace aura { |
18 class Window; | 18 class Window; |
19 } | 19 } |
20 | 20 |
21 namespace gfx { | 21 namespace gfx { |
22 class Point; | 22 class Point; |
23 class Display; | 23 class Display; |
24 } | 24 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 gfx::Rect a_edge_bounds_in_native_; | 77 gfx::Rect a_edge_bounds_in_native_; |
78 gfx::Rect b_edge_bounds_in_native_; | 78 gfx::Rect b_edge_bounds_in_native_; |
79 | 79 |
80 // The bounds for warp hole windows. These are kept in the instance for | 80 // The bounds for warp hole windows. These are kept in the instance for |
81 // testing. | 81 // testing. |
82 gfx::Rect a_indicator_bounds_; | 82 gfx::Rect a_indicator_bounds_; |
83 gfx::Rect b_indicator_bounds_; | 83 gfx::Rect b_indicator_bounds_; |
84 | 84 |
85 // Shows the area where a window can be dragged in to/out from another | 85 // Shows the area where a window can be dragged in to/out from another |
86 // display. | 86 // display. |
87 scoped_ptr<SharedDisplayEdgeIndicator> shared_display_edge_indicator_; | 87 std::unique_ptr<SharedDisplayEdgeIndicator> shared_display_edge_indicator_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(WarpRegion); | 89 DISALLOW_COPY_AND_ASSIGN(WarpRegion); |
90 }; | 90 }; |
91 | 91 |
92 std::vector<scoped_ptr<WarpRegion>> warp_regions_; | 92 std::vector<std::unique_ptr<WarpRegion>> warp_regions_; |
93 | 93 |
94 // Registers the WarpRegion; also displays a drag indicator on the screen if | 94 // Registers the WarpRegion; also displays a drag indicator on the screen if |
95 // |has_drag_source| is true. | 95 // |has_drag_source| is true. |
96 void AddWarpRegion(scoped_ptr<WarpRegion> region, bool has_drag_source); | 96 void AddWarpRegion(std::unique_ptr<WarpRegion> region, bool has_drag_source); |
97 | 97 |
98 // Warps the mouse cursor to an alternate root window when the | 98 // Warps the mouse cursor to an alternate root window when the |
99 // mouse location in |event|, hits the edge of the event target's root and | 99 // mouse location in |event|, hits the edge of the event target's root and |
100 // the mouse cursor is considered to be in an alternate display. | 100 // the mouse cursor is considered to be in an alternate display. |
101 // If |update_mouse_location_now| is true, | 101 // If |update_mouse_location_now| is true, |
102 // Returns true if/ the cursor was moved. | 102 // Returns true if/ the cursor was moved. |
103 bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native, | 103 bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native, |
104 const gfx::Point& point_in_screen, | 104 const gfx::Point& point_in_screen, |
105 bool update_mouse_location_now); | 105 bool update_mouse_location_now); |
106 | 106 |
107 // Creates WarpRegion between display |a| and |b|. | 107 // Creates WarpRegion between display |a| and |b|. |
108 // |drag_source_dispaly_id| is used to indicate in which display a | 108 // |drag_source_dispaly_id| is used to indicate in which display a |
109 // drag is started, or invalid id passed if this is not for | 109 // drag is started, or invalid id passed if this is not for |
110 // dragging. Returns null scoped_ptr if two displays do not share | 110 // dragging. Returns null scoped_ptr if two displays do not share |
111 // the edge. | 111 // the edge. |
112 scoped_ptr<WarpRegion> CreateWarpRegion(const gfx::Display& a, | 112 std::unique_ptr<WarpRegion> CreateWarpRegion(const gfx::Display& a, |
113 const gfx::Display& b, | 113 const gfx::Display& b, |
114 int64_t drag_source_dispay_id); | 114 int64_t drag_source_dispay_id); |
115 | 115 |
116 void allow_non_native_event_for_test() { allow_non_native_event_ = true; } | 116 void allow_non_native_event_for_test() { allow_non_native_event_ = true; } |
117 | 117 |
118 // The root window in which the dragging started. | 118 // The root window in which the dragging started. |
119 aura::Window* drag_source_root_; | 119 aura::Window* drag_source_root_; |
120 | 120 |
121 bool enabled_; | 121 bool enabled_; |
122 | 122 |
123 bool allow_non_native_event_; | 123 bool allow_non_native_event_; |
124 | 124 |
125 DISALLOW_COPY_AND_ASSIGN(ExtendedMouseWarpController); | 125 DISALLOW_COPY_AND_ASSIGN(ExtendedMouseWarpController); |
126 }; | 126 }; |
127 | 127 |
128 } // namespace ash | 128 } // namespace ash |
129 | 129 |
130 #endif // ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H | 130 #endif // ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H |
OLD | NEW |