| // Copyright 2015 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef ASH_DISPLAY_UNIFIED_MOUSE_WARP_CONTROLLER_H |
| #define ASH_DISPLAY_UNIFIED_MOUSE_WARP_CONTROLLER_H |
| |
| #include "ash/display/mouse_warp_controller.h" |
| |
| #include "base/gtest_prod_util.h" |
| #include "ui/gfx/geometry/rect.h" |
| |
| namespace aura { |
| class Window; |
| } |
| |
| namespace gfx { |
| class Point; |
| } |
| |
| namespace ash { |
| namespace test { |
| class DisplayManagerTestApi; |
| } |
| |
| // A MouseWarpController used in unified display mode. |
| class ASH_EXPORT UnifiedMouseWarpController : public MouseWarpController { |
| public: |
| UnifiedMouseWarpController(); |
| ~UnifiedMouseWarpController() override; |
| |
| // MouseWarpController: |
| bool WarpMouseCursor(ui::MouseEvent* event) override; |
| void SetEnabled(bool enabled) override; |
| |
| private: |
| friend class test::DisplayManagerTestApi; |
| FRIEND_TEST_ALL_PREFIXES(UnifiedMouseWarpControllerTest, BoundaryTest); |
| |
| void ComputeBounds(); |
| |
| // Warps the mouse cursor to an alternate root window when the |
| // mouse location in |event|, hits the edge of the event target's root and |
| // the mouse cursor is considered to be in an alternate display. |
| // If |update_mouse_location_now| is true, |
| // Returns true if/ the cursor was moved. |
| bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native, |
| const gfx::Point& point_in_screen, |
| bool update_mouse_location_now); |
| |
| void allow_non_native_event_for_test() { allow_non_native_event_ = true; } |
| |
| gfx::Rect first_edge_bounds_in_native_; |
| gfx::Rect second_edge_bounds_in_native_; |
| |
| bool allow_non_native_event_; |
| |
| DISALLOW_COPY_AND_ASSIGN(UnifiedMouseWarpController); |
| }; |
| |
| } // namespace ash |
| |
| #endif // ASH_DISPLAY_UNIFIED_MOUSE_WARP_CONTROLLER_H |