Add screen space opacity to opacity tree
[chromium-blink-merge.git] / ash / display / extended_mouse_warp_controller.h
blob52de762a1327f18e0f06efb8606a0eda0289cf4d
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_EXTENDED_MOUSE_WARP_CONTROLLER_H
6 #define ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H
8 #include "ash/display/mouse_warp_controller.h"
10 #include "base/gtest_prod_util.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/gfx/geometry/rect.h"
14 namespace aura {
15 class Window;
18 namespace gfx {
19 class Point;
22 namespace ash {
23 namespace test {
24 class DisplayManagerTestApi;
26 class SharedDisplayEdgeIndicator;
28 // A MouseWarpController used in extended display mode.
29 class ASH_EXPORT ExtendedMouseWarpController : public MouseWarpController {
30 public:
31 explicit ExtendedMouseWarpController(aura::Window* drag_source);
32 ~ExtendedMouseWarpController() override;
34 // MouseWarpController:
35 bool WarpMouseCursor(ui::MouseEvent* event) override;
36 void SetEnabled(bool enable) override;
38 private:
39 friend class test::DisplayManagerTestApi;
40 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest,
41 IndicatorBoundsTestOnRight);
42 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest,
43 IndicatorBoundsTestOnLeft);
44 FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest,
45 IndicatorBoundsTestOnTopBottom);
47 // Warps the mouse cursor to an alternate root window when the
48 // mouse location in |event|, hits the edge of the event target's root and
49 // the mouse cursor is considered to be in an alternate display.
50 // If |update_mouse_location_now| is true,
51 // Returns true if/ the cursor was moved.
52 bool WarpMouseCursorInNativeCoords(const gfx::Point& point_in_native,
53 const gfx::Point& point_in_screen,
54 bool update_mouse_location_now);
56 // Update the edge/indicator bounds based on the current
57 // display configuration.
58 void UpdateHorizontalEdgeBounds();
59 void UpdateVerticalEdgeBounds();
61 // Returns the source and destination window. When |src_window| is
62 // |drag_soruce_root_| when it is set. Otherwise, the |src_window|
63 // is always the primary root window, because there is no difference
64 // between moving src to dst and moving dst to src.
65 void GetSrcAndDstRootWindows(aura::Window** src_window,
66 aura::Window** dst_window);
68 void allow_non_native_event_for_test() { allow_non_native_event_ = true; }
70 // The bounds for warp hole windows. |dst_indicator_bounds_| is kept
71 // in the instance for testing.
72 gfx::Rect src_indicator_bounds_;
73 gfx::Rect dst_indicator_bounds_;
75 gfx::Rect src_edge_bounds_in_native_;
76 gfx::Rect dst_edge_bounds_in_native_;
78 // The root window in which the dragging started.
79 aura::Window* drag_source_root_;
81 bool enabled_;
83 // Shows the area where a window can be dragged in to/out from
84 // another display.
85 scoped_ptr<SharedDisplayEdgeIndicator> shared_display_edge_indicator_;
87 bool allow_non_native_event_;
89 DISALLOW_COPY_AND_ASSIGN(ExtendedMouseWarpController);
92 } // namespace ash
94 #endif // ASH_DISPLAY_EXTENDED_MOUSE_WARP_CONTROLLER_H