1 // Copyright (c) 2012 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_MOUSE_CURSOR_EVENT_FILTER_H
6 #define ASH_DISPLAY_MOUSE_CURSOR_EVENT_FILTER_H
8 #include "ash/ash_export.h"
9 #include "ash/display/window_tree_host_manager.h"
10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "ui/events/event_handler.h"
14 #include "ui/gfx/geometry/rect.h"
22 class DisplayEdgeController
;
24 // An event filter that controls mouse location in extended desktop
26 class ASH_EXPORT MouseCursorEventFilter
27 : public ui::EventHandler
,
28 public WindowTreeHostManager::Observer
{
30 MouseCursorEventFilter();
31 ~MouseCursorEventFilter() override
;
33 void set_mouse_warp_enabled(bool enabled
) { mouse_warp_enabled_
= enabled
; }
35 // Shows/Hide the indicator for window dragging. The |from|
36 // is the window where the dragging started.
37 void ShowSharedEdgeIndicator(aura::Window
* from
);
38 void HideSharedEdgeIndicator();
40 // WindowTreeHostManager::Observer:
41 void OnDisplaysInitialized() override
;
42 void OnDisplayConfigurationChanged() override
;
45 void OnMouseEvent(ui::MouseEvent
* event
) override
;
48 friend class test::DisplayManagerTestApi
;
49 friend class ExtendedMouseWarpControllerTest
;
50 friend class MouseCursorEventFilterTest
;
51 friend class UnifiedMouseWarpControllerTest
;
52 FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest
, DoNotWarpTwice
);
53 FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest
, SetMouseWarpModeFlag
);
54 FRIEND_TEST_ALL_PREFIXES(MouseCursorEventFilterTest
,
55 WarpMouseDifferentScaleDisplaysInNative
);
56 FRIEND_TEST_ALL_PREFIXES(DragWindowResizerTest
, WarpMousePointer
);
58 MouseWarpController
* mouse_warp_controller_for_test() {
59 return mouse_warp_controller_
.get();
62 bool mouse_warp_enabled_
;
64 scoped_ptr
<MouseWarpController
> mouse_warp_controller_
;
66 DISALLOW_COPY_AND_ASSIGN(MouseCursorEventFilter
);
71 #endif // ASH_DISPLAY_MOUSE_CURSOR_EVENT_FILTER_H