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
3 // found in the LICENSE file.
5 #ifndef ASH_DISPLAY_UNIFIED_MOUSE_WARP_CONTROLLER_H
6 #define ASH_DISPLAY_UNIFIED_MOUSE_WARP_CONTROLLER_H
8 #include "ash/display/mouse_warp_controller.h"
10 #include "base/gtest_prod_util.h"
11 #include "ui/gfx/geometry/rect.h"
23 class DisplayManagerTestApi
;
26 // A MouseWarpController used in unified display mode.
27 class ASH_EXPORT UnifiedMouseWarpController
: public MouseWarpController
{
29 UnifiedMouseWarpController();
30 ~UnifiedMouseWarpController() override
;
32 // MouseWarpController:
33 bool WarpMouseCursor(ui::MouseEvent
* event
) override
;
34 void SetEnabled(bool enabled
) override
;
37 friend class test::DisplayManagerTestApi
;
38 FRIEND_TEST_ALL_PREFIXES(UnifiedMouseWarpControllerTest
, BoundaryTest
);
42 // Warps the mouse cursor to an alternate root window when the
43 // mouse location in |event|, hits the edge of the event target's root and
44 // the mouse cursor is considered to be in an alternate display.
45 // If |update_mouse_location_now| is true,
46 // Returns true if/ the cursor was moved.
47 bool WarpMouseCursorInNativeCoords(const gfx::Point
& point_in_native
,
48 const gfx::Point
& point_in_screen
,
49 bool update_mouse_location_now
);
51 void allow_non_native_event_for_test() { allow_non_native_event_
= true; }
53 gfx::Rect first_edge_bounds_in_native_
;
54 gfx::Rect second_edge_bounds_in_native_
;
56 bool allow_non_native_event_
;
58 DISALLOW_COPY_AND_ASSIGN(UnifiedMouseWarpController
);
63 #endif // ASH_DISPLAY_UNIFIED_MOUSE_WARP_CONTROLLER_H