OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef COMPONENTS_MUS_WS_EVENT_DISPATCHER_DELEGATE_H_ | |
6 #define COMPONENTS_MUS_WS_EVENT_DISPATCHER_DELEGATE_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "components/mus/common/types.h" | |
11 | |
12 namespace gfx { | |
13 class Point; | |
14 } | |
15 | |
16 namespace ui { | |
17 class Event; | |
18 } | |
19 | |
20 namespace mus { | |
21 namespace ws { | |
22 | |
23 class Accelerator; | |
24 class ServerWindow; | |
25 | |
26 // Used by EventDispatcher for mocking in tests. | |
27 class EventDispatcherDelegate { | |
28 public: | |
29 virtual void OnAccelerator(uint32_t accelerator, const ui::Event& event) = 0; | |
30 | |
31 virtual void SetFocusedWindowFromEventDispatcher(ServerWindow* window) = 0; | |
32 virtual ServerWindow* GetFocusedWindowForEventDispatcher() = 0; | |
33 | |
34 // Called when capture should be set on the native display. |window| is the | |
35 // window capture is being set on. | |
36 virtual void SetNativeCapture(ServerWindow* window) = 0; | |
37 // Called when the native display is having capture released. There is no | |
38 // longer a ServerWindow holding capture. | |
39 virtual void ReleaseNativeCapture() = 0; | |
40 // Called when |window| has lost capture. The native display may still be | |
41 // holding capture. The delegate should not change native display capture. | |
42 // ReleaseNativeCapture() is invoked if appropriate. | |
43 virtual void OnServerWindowCaptureLost(ServerWindow* window) = 0; | |
44 | |
45 virtual void OnMouseCursorLocationChanged(const gfx::Point& point) = 0; | |
46 | |
47 // Dispatches an event to the specific client. | |
48 virtual void DispatchInputEventToWindow(ServerWindow* target, | |
49 ClientSpecificId client_id, | |
50 const ui::Event& event, | |
51 Accelerator* accelerator) = 0; | |
52 | |
53 // Returns the id of the client to send events to. |in_nonclient_area| is | |
54 // true if the event occurred in the non-client area of the window. | |
55 virtual ClientSpecificId GetEventTargetClientId(const ServerWindow* window, | |
56 bool in_nonclient_area) = 0; | |
57 | |
58 // Returns the window to start searching from at the specified location, or | |
59 // null if there is a no window containing |location|. | |
60 virtual ServerWindow* GetRootWindowContaining(const gfx::Point& location) = 0; | |
61 | |
62 // Called when event dispatch could not find a target. OnAccelerator may still | |
63 // be called. | |
64 virtual void OnEventTargetNotFound(const ui::Event& event) = 0; | |
65 | |
66 protected: | |
67 virtual ~EventDispatcherDelegate() {} | |
68 }; | |
69 | |
70 } // namespace ws | |
71 } // namespace mus | |
72 | |
73 #endif // COMPONENTS_MUS_WS_EVENT_DISPATCHER_DELEGATE_H_ | |
OLD | NEW |