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..d1502064f7b99b9cf7f13eb45c9f1fef864b66cf 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 { |
@@ -44,6 +48,47 @@ class ASH_EXPORT ExtendedMouseWarpController : public MouseWarpController { |
IndicatorBoundsTestOnLeft); |
FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, |
IndicatorBoundsTestOnTopBottom); |
+ FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest, |
+ IndicatorBoundsTestThreeDisplays); |
+ |
+ // Defined in header file because tests need access. |
+ struct WarpRegion { |
+ 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; |
stevenjb
2016/01/23 02:09:38
FWIW, typically we use class for anything that has
jdufault
2016/01/25 21:32:16
I've changed this from a struct to a class. This i
|
+ |
+ 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 |
@@ -56,35 +101,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); |