Chromium Code Reviews| 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 SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_ | 5 #ifndef SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_ |
| 6 #define SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_ | 6 #define SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "services/ui/common/types.h" | 10 #include "services/ui/common/types.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 | 24 |
| 25 // Used by EventDispatcher for mocking in tests. | 25 // Used by EventDispatcher for mocking in tests. |
| 26 class EventDispatcherDelegate { | 26 class EventDispatcherDelegate { |
| 27 public: | 27 public: |
| 28 enum class AcceleratorPhase { | 28 enum class AcceleratorPhase { |
| 29 PRE, | 29 PRE, |
| 30 POST, | 30 POST, |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 virtual void OnAccelerator(uint32_t accelerator, | 33 virtual void OnAccelerator(uint32_t accelerator, |
| 34 const int64_t display_id, | 34 int64_t display_id, |
| 35 const ui::Event& event, | 35 const ui::Event& event, |
| 36 AcceleratorPhase phase) = 0; | 36 AcceleratorPhase phase) = 0; |
| 37 | 37 |
| 38 virtual void SetFocusedWindowFromEventDispatcher(ServerWindow* window) = 0; | 38 virtual void SetFocusedWindowFromEventDispatcher(ServerWindow* window) = 0; |
| 39 virtual ServerWindow* GetFocusedWindowForEventDispatcher( | 39 virtual ServerWindow* GetFocusedWindowForEventDispatcher( |
| 40 const int64_t display_id) = 0; | 40 int64_t display_id) = 0; |
| 41 | 41 |
| 42 // Called when capture should be set on the native display. |window| is the | 42 // Called when capture should be set on the native display. |window| is the |
| 43 // window capture is being set on. | 43 // window capture is being set on. |
| 44 virtual void SetNativeCapture(ServerWindow* window) = 0; | 44 virtual void SetNativeCapture(ServerWindow* window) = 0; |
| 45 | 45 |
| 46 // Called when the native display is having capture released. There is no | 46 // Called when the native display is having capture released. There is no |
| 47 // longer a ServerWindow holding capture. | 47 // longer a ServerWindow holding capture. |
| 48 virtual void ReleaseNativeCapture() = 0; | 48 virtual void ReleaseNativeCapture() = 0; |
| 49 | 49 |
| 50 // Called when EventDispatcher has a new value for the cursor and our | 50 // Called when EventDispatcher has a new value for the cursor and our |
| 51 // delegate should perform the native updates. | 51 // delegate should perform the native updates. |
| 52 virtual void UpdateNativeCursorFromDispatcher() = 0; | 52 virtual void UpdateNativeCursorFromDispatcher() = 0; |
| 53 | 53 |
| 54 // Called when |window| has lost capture. The native display may still be | 54 // Called when |window| has lost capture. The native display may still be |
| 55 // holding capture. The delegate should not change native display capture. | 55 // holding capture. The delegate should not change native display capture. |
| 56 // ReleaseNativeCapture() is invoked if appropriate. | 56 // ReleaseNativeCapture() is invoked if appropriate. |
| 57 virtual void OnCaptureChanged(ServerWindow* new_capture, | 57 virtual void OnCaptureChanged(ServerWindow* new_capture, |
| 58 ServerWindow* old_capture) = 0; | 58 ServerWindow* old_capture) = 0; |
| 59 | 59 |
| 60 virtual void OnMouseCursorLocationChanged(const gfx::Point& point, | 60 virtual void OnMouseCursorLocationChanged(const gfx::Point& point, |
| 61 const int64_t display_id) = 0; | 61 int64_t display_id) = 0; |
| 62 | 62 |
| 63 // Dispatches an event to the specific client. | 63 // Dispatches an event to the specific client. |
| 64 virtual void DispatchInputEventToWindow(ServerWindow* target, | 64 virtual void DispatchInputEventToWindow(ServerWindow* target, |
| 65 ClientSpecificId client_id, | 65 ClientSpecificId client_id, |
| 66 const int64_t display_id, | 66 int64_t display_id, |
| 67 const ui::Event& event, | 67 const ui::Event& event, |
| 68 Accelerator* accelerator) = 0; | 68 Accelerator* accelerator) = 0; |
| 69 | 69 |
| 70 // Starts processing the next event in the event queue. | |
| 71 virtual void ProcessNextEventFromQueue() = 0; | |
|
sadrul
2017/06/07 20:16:04
Instead of saying FromQueue, maybe 'ProcessNextAva
riajiang
2017/06/07 21:46:25
Changed to ProcessNextAvailableEvent.
| |
| 72 | |
| 70 // Returns the id of the client to send events to. |in_nonclient_area| is | 73 // Returns the id of the client to send events to. |in_nonclient_area| is |
| 71 // true if the event occurred in the non-client area of the window. | 74 // true if the event occurred in the non-client area of the window. |
| 72 virtual ClientSpecificId GetEventTargetClientId(const ServerWindow* window, | 75 virtual ClientSpecificId GetEventTargetClientId(const ServerWindow* window, |
| 73 bool in_nonclient_area) = 0; | 76 bool in_nonclient_area) = 0; |
| 74 | 77 |
| 75 // Returns the window to start searching from at the specified location, or | 78 // Returns the window to start searching from at the specified location, or |
| 76 // null if there is a no window containing |location_in_display|. | 79 // null if there is a no window containing |location_in_display|. |
| 77 // |location_in_display| is in display coordinates and in pixels. | 80 // |location_in_display| is in display coordinates and in pixels. |
| 78 // |location_in_display| and |display_id| are updated if the window we | 81 // |location_in_display| and |display_id| are updated if the window we |
| 79 // found is on a different display than the originated display. | 82 // found is on a different display than the originated display. |
| 80 // TODO(riajiang): No need to update |location_in_display| and |display_id| | 83 // TODO(riajiang): No need to update |location_in_display| and |display_id| |
| 81 // after ozone drm can tell us the right display the cursor is on for | 84 // after ozone drm can tell us the right display the cursor is on for |
| 82 // drag-n-drop events. crbug.com/726470 | 85 // drag-n-drop events. crbug.com/726470 |
| 83 virtual ServerWindow* GetRootWindowContaining(gfx::Point* location_in_display, | 86 virtual ServerWindow* GetRootWindowContaining(gfx::Point* location_in_display, |
| 84 int64_t* display_id) = 0; | 87 int64_t* display_id) = 0; |
| 85 | 88 |
| 86 // Called when event dispatch could not find a target. OnAccelerator may still | 89 // Called when event dispatch could not find a target. OnAccelerator may still |
| 87 // be called. | 90 // be called. |
| 88 virtual void OnEventTargetNotFound(const ui::Event& event, | 91 virtual void OnEventTargetNotFound(const ui::Event& event, |
| 89 const int64_t display_id) = 0; | 92 int64_t display_id) = 0; |
| 90 | 93 |
| 91 protected: | 94 protected: |
| 92 virtual ~EventDispatcherDelegate() {} | 95 virtual ~EventDispatcherDelegate() {} |
| 93 }; | 96 }; |
| 94 | 97 |
| 95 } // namespace ws | 98 } // namespace ws |
| 96 } // namespace ui | 99 } // namespace ui |
| 97 | 100 |
| 98 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_ | 101 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_DELEGATE_H_ |
| OLD | NEW |