Chromium Code Reviews| Index: ash/display/extended_mouse_warp_controller.h |
| diff --git a/ash/display/extended_mouse_warp_controller.h b/ash/display/extended_mouse_warp_controller.h |
| index 162afa684e0ed521ae016bf3b27c508bb2f0e8f3..98de68f67796c03729bfb2bf98b7e025ce425edc 100644 |
| --- a/ash/display/extended_mouse_warp_controller.h |
| +++ b/ash/display/extended_mouse_warp_controller.h |
| @@ -7,6 +7,9 @@ |
| #include "ash/display/mouse_warp_controller.h" |
| +#include <vector> |
| + |
| +#include "ash/display/display_layout.h" |
| #include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| @@ -18,6 +21,7 @@ class Window; |
| namespace gfx { |
| class Point; |
| +class Display; |
| } |
| namespace ash { |
| @@ -45,6 +49,44 @@ class ASH_EXPORT ExtendedMouseWarpController : public MouseWarpController { |
| FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, |
| IndicatorBoundsTestOnTopBottom); |
| + struct WarpRegion { |
|
oshima
2016/01/20 18:35:55
can you move the definition to .cc?
jdufault
2016/01/20 23:37:16
Tests need access to the definition. I've added a
|
| + public: |
| + WarpRegion(int64_t a_display_id, |
| + int64_t b_display_id, |
| + const gfx::Rect& a_indicator_bounds, |
| + const gfx::Rect& b_indicator_bounds); |
| + ~WarpRegion(); |
| + |
| + // If the mouse cursor is in |a_edge_bounds_in_native|, then it will be |
| + // moved to |b_display_id|. Similarily, if the cursor is in |
| + // |b_edge_bounds_in_native|, then it will be moved to |a_display_id|. |
| + |
| + // The id for the displays. Used for warping the cursor. |
| + int64_t a_display_id; |
| + int64_t b_display_id; |
| + |
| + gfx::Rect a_edge_bounds_in_native; |
| + gfx::Rect b_edge_bounds_in_native; |
| + |
| + // The bounds for warp hole windows. These are kept in the instance for |
| + // testing. |
| + gfx::Rect a_indicator_bounds; |
| + gfx::Rect b_indicator_bounds; |
| + |
| + // Shows the area where a window can be dragged in to/out from another |
| + // display. |
| + scoped_ptr<SharedDisplayEdgeIndicator> shared_display_edge_indicator; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(WarpRegion); |
| + }; |
| + |
| + std::vector<scoped_ptr<WarpRegion>> warp_regions_; |
| + |
| + // Registers the WarpRegion; also displays a drag indicator on the screen if |
| + // |drag_source| is true. |
| + void AddWarpRegion(scoped_ptr<WarpRegion> region, bool drag_source); |
| + |
| // 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. |
| @@ -56,35 +98,22 @@ class ASH_EXPORT ExtendedMouseWarpController : public MouseWarpController { |
| // Update the edge/indicator bounds based on the current |
| // display configuration. |
| - void UpdateHorizontalEdgeBounds(); |
| - void UpdateVerticalEdgeBounds(); |
| - |
| - // Returns the source and destination window. When |src_window| is |
| - // |drag_soruce_root_| when it is set. Otherwise, the |src_window| |
| - // is always the primary root window, because there is no difference |
| - // between moving src to dst and moving dst to src. |
| - void GetSrcAndDstRootWindows(aura::Window** src_window, |
| - aura::Window** dst_window); |
| + scoped_ptr<WarpRegion> CreateHorizontalEdgeBounds( |
| + const gfx::Display& a, |
| + const gfx::Display& b, |
| + DisplayLayout::Position position); |
| + scoped_ptr<WarpRegion> CreateVerticalEdgeBounds( |
| + const gfx::Display& a, |
| + const gfx::Display& b, |
| + DisplayLayout::Position position); |
| void allow_non_native_event_for_test() { allow_non_native_event_ = true; } |
| - // The bounds for warp hole windows. |dst_indicator_bounds_| is kept |
| - // in the instance for testing. |
| - gfx::Rect src_indicator_bounds_; |
| - gfx::Rect dst_indicator_bounds_; |
| - |
| - gfx::Rect src_edge_bounds_in_native_; |
| - gfx::Rect dst_edge_bounds_in_native_; |
| - |
| // The root window in which the dragging started. |
| aura::Window* drag_source_root_; |
| bool enabled_; |
| - // Shows the area where a window can be dragged in to/out from |
| - // another display. |
| - scoped_ptr<SharedDisplayEdgeIndicator> shared_display_edge_indicator_; |
| - |
| bool allow_non_native_event_; |
| DISALLOW_COPY_AND_ASSIGN(ExtendedMouseWarpController); |