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/window_manager.mojom.h" |
| 18 #include "services/ui/ws/drag_cursor_updater.h" | 18 #include "services/ui/ws/drag_cursor_updater.h" |
| 19 #include "services/ui/ws/modal_window_controller.h" | 19 #include "services/ui/ws/modal_window_controller.h" |
| 20 #include "services/ui/ws/server_window_observer.h" | 20 #include "services/ui/ws/server_window_observer.h" |
| 21 #include "ui/gfx/geometry/rect_f.h" | 21 #include "ui/gfx/geometry/rect_f.h" |
| 22 | 22 |
| 23 namespace ui { | 23 namespace ui { |
| 24 class Event; | 24 class Event; |
| 25 class KeyEvent; | 25 class KeyEvent; |
| 26 class LocatedEvent; | 26 class LocatedEvent; |
| 27 | 27 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 | 119 |
| 120 // Possibly updates the cursor. If we aren't in an implicit capture, we take | 120 // 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 | 121 // the last known location of the mouse pointer, and look for the |
| 122 // ServerWindow* under it. | 122 // ServerWindow* under it. |
| 123 void UpdateCursorProviderByLastKnownLocation(); | 123 void UpdateCursorProviderByLastKnownLocation(); |
| 124 | 124 |
| 125 // Adds an accelerator with the given id and event-matcher. If an accelerator | 125 // Adds an accelerator with the given id and event-matcher. If an accelerator |
| 126 // already exists with the same id or the same matcher, then the accelerator | 126 // 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. | 127 // is not added. Returns whether adding the accelerator was successful or not. |
| 128 bool AddAccelerator(uint32_t id, mojom::EventMatcherPtr event_matcher); | 128 bool AddAccelerator(uint32_t id, mojom::EventMatcherPtr event_matcher); |
| 129 | |
| 130 // Adds the supplied accelerators and ignores any accelerators already | |
| 131 // defined with the same id or matcher. Returns true if all accelerators were | |
| 132 // added successfully. | |
| 133 // This function should only be used from WindowTreeClient. | |
| 134 bool AddAccelerators(std::vector<ui::mojom::AcceleratorPtr> accelerators); | |
|
sky
2016/12/02 17:25:42
Sorry if I wasn't clear. I'm suggesting you do *no
thanhph
2016/12/02 21:21:43
Thanks for the explantion Scott. I removed functio
| |
| 135 | |
| 129 void RemoveAccelerator(uint32_t id); | 136 void RemoveAccelerator(uint32_t id); |
| 130 | 137 |
| 131 // Processes the supplied event, informing the delegate as approriate. This | 138 // Processes the supplied event, informing the delegate as approriate. This |
| 132 // may result in generating any number of events. If |match_phase| is | 139 // 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 | 140 // 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 | 141 // OnAccelerator() is called. The expectation is after the PRE_TARGET has been |
| 135 // handled this is again called with an AcceleratorMatchPhase of POST_ONLY. | 142 // handled this is again called with an AcceleratorMatchPhase of POST_ONLY. |
| 136 void ProcessEvent(const ui::Event& event, AcceleratorMatchPhase match_phase); | 143 void ProcessEvent(const ui::Event& event, AcceleratorMatchPhase match_phase); |
| 137 | 144 |
| 138 private: | 145 private: |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 AcceleratorMatchPhase::ANY; | 278 AcceleratorMatchPhase::ANY; |
| 272 #endif | 279 #endif |
| 273 | 280 |
| 274 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); | 281 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); |
| 275 }; | 282 }; |
| 276 | 283 |
| 277 } // namespace ws | 284 } // namespace ws |
| 278 } // namespace ui | 285 } // namespace ui |
| 279 | 286 |
| 280 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_ | 287 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_ |
| OLD | NEW |