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_H_ | 5 #ifndef SERVICES_UI_WS_EVENT_DISPATCHER_H_ |
| 6 #define SERVICES_UI_WS_EVENT_DISPATCHER_H_ | 6 #define SERVICES_UI_WS_EVENT_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "services/ui/common/types.h" | 15 #include "services/ui/common/types.h" |
| 16 #include "services/ui/public/interfaces/cursor.mojom.h" | 16 #include "services/ui/public/interfaces/cursor.mojom.h" |
| 17 #include "services/ui/public/interfaces/event_matcher.mojom.h" | 17 #include "services/ui/public/interfaces/event_matcher.mojom.h" |
| 18 #include "services/ui/public/interfaces/window_manager.mojom.h" | |
| 18 #include "services/ui/ws/drag_cursor_updater.h" | 19 #include "services/ui/ws/drag_cursor_updater.h" |
| 19 #include "services/ui/ws/modal_window_controller.h" | 20 #include "services/ui/ws/modal_window_controller.h" |
| 20 #include "services/ui/ws/server_window_observer.h" | 21 #include "services/ui/ws/server_window_observer.h" |
| 21 #include "ui/gfx/geometry/rect_f.h" | 22 #include "ui/gfx/geometry/rect_f.h" |
| 22 | 23 |
| 23 namespace ui { | 24 namespace ui { |
| 24 class Event; | 25 class Event; |
| 25 class KeyEvent; | 26 class KeyEvent; |
| 26 class LocatedEvent; | 27 class LocatedEvent; |
| 27 | 28 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 // If the mouse cursor is still over |mouse_cursor_source_window_|, updates | 116 // If the mouse cursor is still over |mouse_cursor_source_window_|, updates |
| 116 // whether we are in the non-client area. Used when | 117 // whether we are in the non-client area. Used when |
| 117 // |mouse_cursor_source_window_| has changed its properties. | 118 // |mouse_cursor_source_window_| has changed its properties. |
| 118 void UpdateNonClientAreaForCurrentWindow(); | 119 void UpdateNonClientAreaForCurrentWindow(); |
| 119 | 120 |
| 120 // Possibly updates the cursor. If we aren't in an implicit capture, we take | 121 // Possibly updates the cursor. If we aren't in an implicit capture, we take |
| 121 // the last known location of the mouse pointer, and look for the | 122 // the last known location of the mouse pointer, and look for the |
| 122 // ServerWindow* under it. | 123 // ServerWindow* under it. |
| 123 void UpdateCursorProviderByLastKnownLocation(); | 124 void UpdateCursorProviderByLastKnownLocation(); |
| 124 | 125 |
| 125 // Adds an accelerator with the given id and event-matcher. If an accelerator | 126 // Adds an accelerator with the given id and event-matcher. If an accelerator |
|
mfomitchev
2016/11/24 19:56:13
Please update the comment
thanhph
2016/11/29 00:08:29
Done.
| |
| 126 // already exists with the same id or the same matcher, then the accelerator | 127 // already exists with the same id or the same matcher, then the accelerator |
| 127 // is not added. Returns whether adding the accelerator was successful or not. | 128 // is not added. Returns whether adding the accelerator was successful or not. |
| 128 bool AddAccelerator(uint32_t id, mojom::EventMatcherPtr event_matcher); | 129 bool AddAccelerators( |
| 130 std::vector<ui::mojom::AcceleratorTransportPtr> multi_accelerators); | |
| 131 | |
| 129 void RemoveAccelerator(uint32_t id); | 132 void RemoveAccelerator(uint32_t id); |
| 130 | 133 |
| 131 // Processes the supplied event, informing the delegate as approriate. This | 134 // Processes the supplied event, informing the delegate as approriate. This |
| 132 // may result in generating any number of events. If |match_phase| is | 135 // may result in generating any number of events. If |match_phase| is |
| 133 // ANY and there is a matching accelerator with PRE_TARGET found, than only | 136 // ANY and there is a matching accelerator with PRE_TARGET found, than only |
| 134 // OnAccelerator() is called. The expectation is after the PRE_TARGET has been | 137 // OnAccelerator() is called. The expectation is after the PRE_TARGET has been |
| 135 // handled this is again called with an AcceleratorMatchPhase of POST_ONLY. | 138 // handled this is again called with an AcceleratorMatchPhase of POST_ONLY. |
| 136 void ProcessEvent(const ui::Event& event, AcceleratorMatchPhase match_phase); | 139 void ProcessEvent(const ui::Event& event, AcceleratorMatchPhase match_phase); |
| 137 | 140 |
| 138 private: | 141 private: |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 AcceleratorMatchPhase::ANY; | 274 AcceleratorMatchPhase::ANY; |
| 272 #endif | 275 #endif |
| 273 | 276 |
| 274 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); | 277 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); |
| 275 }; | 278 }; |
| 276 | 279 |
| 277 } // namespace ws | 280 } // namespace ws |
| 278 } // namespace ui | 281 } // namespace ui |
| 279 | 282 |
| 280 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_ | 283 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_ |
| OLD | NEW |