Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: services/ui/ws/event_dispatcher.h

Issue 2520093003: WindowManagerClient::AddAccelerator() should take an array (Closed)
Patch Set: Rename/refactor code. Add unit test for multiple accelerators. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // If the mouse cursor is still over |mouse_cursor_source_window_|, updates 115 // If the mouse cursor is still over |mouse_cursor_source_window_|, updates
116 // whether we are in the non-client area. Used when 116 // whether we are in the non-client area. Used when
117 // |mouse_cursor_source_window_| has changed its properties. 117 // |mouse_cursor_source_window_| has changed its properties.
118 void UpdateNonClientAreaForCurrentWindow(); 118 void UpdateNonClientAreaForCurrentWindow();
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 the supplied accelerators. If an accelerator with the same id or
126 // already exists with the same id or the same matcher, then the accelerator 126 // matcher already exists, skip it. Returns true if all accelerators were
127 // is not added. Returns whether adding the accelerator was successful or not. 127 // added successfully.
128 bool AddAccelerator(uint32_t id, mojom::EventMatcherPtr event_matcher); 128 bool AddAccelerators(
129 std::vector<ui::mojom::AcceleratorTransportPtr> accelerators);
mfomitchev 2016/11/29 18:23:15 no need for ui:: prefix - we are in ui namespace a
130
129 void RemoveAccelerator(uint32_t id); 131 void RemoveAccelerator(uint32_t id);
130 132
131 // Processes the supplied event, informing the delegate as approriate. This 133 // Processes the supplied event, informing the delegate as approriate. This
132 // may result in generating any number of events. If |match_phase| is 134 // 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 135 // 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 136 // OnAccelerator() is called. The expectation is after the PRE_TARGET has been
135 // handled this is again called with an AcceleratorMatchPhase of POST_ONLY. 137 // handled this is again called with an AcceleratorMatchPhase of POST_ONLY.
136 void ProcessEvent(const ui::Event& event, AcceleratorMatchPhase match_phase); 138 void ProcessEvent(const ui::Event& event, AcceleratorMatchPhase match_phase);
137 139
138 private: 140 private:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 AcceleratorMatchPhase::ANY; 273 AcceleratorMatchPhase::ANY;
272 #endif 274 #endif
273 275
274 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); 276 DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
275 }; 277 };
276 278
277 } // namespace ws 279 } // namespace ws
278 } // namespace ui 280 } // namespace ui
279 281
280 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_ 282 #endif // SERVICES_UI_WS_EVENT_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698