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