Roll src/third_party/skia df0c557:468dfa7
[chromium-blink-merge.git] / ash / display / unified_mouse_warp_controller.h
blob8fc749c68185bb6e3de9458595622e6f4ae8253e
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"
13 namespace aura {
14 class Window;
17 namespace gfx {
18 class Point;
21 namespace ash {
22 namespace test {
23 class DisplayManagerTestApi;
26 // A MouseWarpController used in unified display mode.
27 class ASH_EXPORT UnifiedMouseWarpController : public MouseWarpController {
28 public:
29 UnifiedMouseWarpController();
30 ~UnifiedMouseWarpController() override;
32 // MouseWarpController:
33 bool WarpMouseCursor(ui::MouseEvent* event) override;
34 void SetEnabled(bool enabled) override;
36 private:
37 friend class test::DisplayManagerTestApi;
38 friend class UnifiedMouseWarpControllerTest;
40 void ComputeBounds();
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);
61 } // namespace ash
63 #endif // ASH_DISPLAY_UNIFIED_MOUSE_WARP_CONTROLLER_H