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_UNIFIED_MOUSE_WARP_CONTROLLER_H_ | 5 #ifndef ASH_DISPLAY_UNIFIED_MOUSE_WARP_CONTROLLER_H_ |
6 #define ASH_DISPLAY_UNIFIED_MOUSE_WARP_CONTROLLER_H_ | 6 #define ASH_DISPLAY_UNIFIED_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 <stdint.h> | 10 #include <stdint.h> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
14 | 14 |
15 namespace aura { | 15 namespace aura { |
16 class Window; | 16 class Window; |
17 } | 17 } |
18 | 18 |
19 namespace gfx { | 19 namespace gfx { |
20 class Point; | 20 class Point; |
21 } | 21 } |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 namespace test { | 24 namespace test { |
| 25 class AshTestBase; |
25 class DisplayManagerTestApi; | 26 class DisplayManagerTestApi; |
26 } | 27 } |
27 | 28 |
28 // A MouseWarpController used in unified display mode. | 29 // A MouseWarpController used in unified display mode. |
29 class ASH_EXPORT UnifiedMouseWarpController : public MouseWarpController { | 30 class ASH_EXPORT UnifiedMouseWarpController : public MouseWarpController { |
30 public: | 31 public: |
31 UnifiedMouseWarpController(); | 32 UnifiedMouseWarpController(); |
32 ~UnifiedMouseWarpController() override; | 33 ~UnifiedMouseWarpController() override; |
33 | 34 |
34 // MouseWarpController: | 35 // MouseWarpController: |
35 bool WarpMouseCursor(ui::MouseEvent* event) override; | 36 bool WarpMouseCursor(ui::MouseEvent* event) override; |
36 void SetEnabled(bool enabled) override; | 37 void SetEnabled(bool enabled) override; |
37 | 38 |
38 private: | 39 private: |
| 40 friend class test::AshTestBase; |
39 friend class test::DisplayManagerTestApi; | 41 friend class test::DisplayManagerTestApi; |
40 friend class UnifiedMouseWarpControllerTest; | 42 friend class UnifiedMouseWarpControllerTest; |
41 | 43 |
42 void ComputeBounds(); | 44 void ComputeBounds(); |
43 | 45 |
44 // Warps the mouse cursor to an alternate root window when the | 46 // Warps the mouse cursor to an alternate root window when the |
45 // mouse location in |event|, hits the edge of the event target's root and | 47 // mouse location in |event|, hits the edge of the event target's root and |
46 // the mouse cursor is considered to be in an alternate display. | 48 // the mouse cursor is considered to be in an alternate display. |
47 // If |update_mouse_location_now| is true, | 49 // If |update_mouse_location_now| is true, |
48 // Returns true if/ the cursor was moved. | 50 // Returns true if/ the cursor was moved. |
49 bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native, | 51 bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native, |
50 const gfx::Point& point_in_screen, | 52 const gfx::Point& point_in_screen, |
51 bool update_mouse_location_now); | 53 bool update_mouse_location_now); |
52 | 54 |
53 void update_location_for_test() { update_location_for_test_ = true; } | 55 void update_location_for_test() { update_location_for_test_ = true; } |
54 | 56 |
55 gfx::Rect first_edge_bounds_in_native_; | 57 gfx::Rect first_edge_bounds_in_native_; |
56 gfx::Rect second_edge_bounds_in_native_; | 58 gfx::Rect second_edge_bounds_in_native_; |
57 | 59 |
58 int64_t current_cursor_display_id_; | 60 int64_t current_cursor_display_id_; |
59 | 61 |
60 bool update_location_for_test_; | 62 bool update_location_for_test_; |
61 | 63 |
62 DISALLOW_COPY_AND_ASSIGN(UnifiedMouseWarpController); | 64 DISALLOW_COPY_AND_ASSIGN(UnifiedMouseWarpController); |
63 }; | 65 }; |
64 | 66 |
65 } // namespace ash | 67 } // namespace ash |
66 | 68 |
67 #endif // ASH_DISPLAY_UNIFIED_MOUSE_WARP_CONTROLLER_H_ | 69 #endif // ASH_DISPLAY_UNIFIED_MOUSE_WARP_CONTROLLER_H_ |
OLD | NEW |