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

Side by Side Diff: ui/aura/window_event_dispatcher.h

Issue 2681613002: Avoid two targeting phases in aura client-lib and EventProcessor. (Closed)
Patch Set: early return Created 3 years, 9 months 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
« no previous file with comments | « ui/aura/test/test_window_targeter.cc ('k') | ui/aura/window_event_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 UI_AURA_WINDOW_EVENT_DISPATCHER_H_ 5 #ifndef UI_AURA_WINDOW_EVENT_DISPATCHER_H_
6 #define UI_AURA_WINDOW_EVENT_DISPATCHER_H_ 6 #define UI_AURA_WINDOW_EVENT_DISPATCHER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 class GestureEvent; 31 class GestureEvent;
32 class GestureRecognizer; 32 class GestureRecognizer;
33 class MouseEvent; 33 class MouseEvent;
34 class TouchEvent; 34 class TouchEvent;
35 } 35 }
36 36
37 namespace aura { 37 namespace aura {
38 class MusMouseLocationUpdater; 38 class MusMouseLocationUpdater;
39 class TestScreen; 39 class TestScreen;
40 class EnvInputStateController; 40 class EnvInputStateController;
41 class WindowTargeter;
41 class WindowTreeHost; 42 class WindowTreeHost;
42 43
43 namespace test { 44 namespace test {
44 class WindowEventDispatcherTestApi; 45 class WindowEventDispatcherTestApi;
45 } 46 }
46 47
47 // WindowEventDispatcher orchestrates event dispatch within a window tree 48 // WindowEventDispatcher orchestrates event dispatch within a window tree
48 // owned by WindowTreeHost. WTH also owns the WED. 49 // owned by WindowTreeHost. WTH also owns the WED.
49 // TODO(beng): In progress, remove functionality not directly related to 50 // TODO(beng): In progress, remove functionality not directly related to
50 // event dispatch. 51 // event dispatch.
51 class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, 52 class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor,
52 public ui::GestureEventHelper, 53 public ui::GestureEventHelper,
53 public client::CaptureDelegate, 54 public client::CaptureDelegate,
54 public WindowObserver, 55 public WindowObserver,
55 public EnvObserver { 56 public EnvObserver {
56 public: 57 public:
57 explicit WindowEventDispatcher(WindowTreeHost* host); 58 explicit WindowEventDispatcher(WindowTreeHost* host);
58 ~WindowEventDispatcher() override; 59 ~WindowEventDispatcher() override;
59 60
60 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } 61 Window* mouse_pressed_handler() { return mouse_pressed_handler_; }
61 Window* mouse_moved_handler() { return mouse_moved_handler_; } 62 Window* mouse_moved_handler() { return mouse_moved_handler_; }
62 63
64 // Overridden from ui::EventProcessor:
65 ui::EventTargeter* GetDefaultEventTargeter() override;
66
63 // Repost event for re-processing. Used when exiting context menus. 67 // Repost event for re-processing. Used when exiting context menus.
64 // We support the ET_MOUSE_PRESSED, ET_TOUCH_PRESSED and ET_GESTURE_TAP_DOWN 68 // We support the ET_MOUSE_PRESSED, ET_TOUCH_PRESSED and ET_GESTURE_TAP_DOWN
65 // event types (although the latter is currently a no-op). 69 // event types (although the latter is currently a no-op).
66 void RepostEvent(const ui::LocatedEvent* event); 70 void RepostEvent(const ui::LocatedEvent* event);
67 71
68 // Invoked when the mouse events get enabled or disabled. 72 // Invoked when the mouse events get enabled or disabled.
69 void OnMouseEventsEnableStateChanged(bool enabled); 73 void OnMouseEventsEnableStateChanged(bool enabled);
70 74
71 void DispatchCancelModeEvent(); 75 void DispatchCancelModeEvent();
72 76
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 170
167 bool is_dispatched_held_event(const ui::Event& event) const; 171 bool is_dispatched_held_event(const ui::Event& event) const;
168 172
169 // Overridden from aura::client::CaptureDelegate: 173 // Overridden from aura::client::CaptureDelegate:
170 void UpdateCapture(Window* old_capture, Window* new_capture) override; 174 void UpdateCapture(Window* old_capture, Window* new_capture) override;
171 void OnOtherRootGotCapture() override; 175 void OnOtherRootGotCapture() override;
172 void SetNativeCapture() override; 176 void SetNativeCapture() override;
173 void ReleaseNativeCapture() override; 177 void ReleaseNativeCapture() override;
174 178
175 // Overridden from ui::EventProcessor: 179 // Overridden from ui::EventProcessor:
176 ui::EventTarget* GetRootTarget() override; 180 ui::EventTarget* GetRootForEvent(ui::Event* event) override;
177 void OnEventProcessingStarted(ui::Event* event) override; 181 void OnEventProcessingStarted(ui::Event* event) override;
178 void OnEventProcessingFinished(ui::Event* event) override; 182 void OnEventProcessingFinished(ui::Event* event) override;
179 183
180 // Overridden from ui::EventDispatcherDelegate. 184 // Overridden from ui::EventDispatcherDelegate.
181 bool CanDispatchToTarget(ui::EventTarget* target) override; 185 bool CanDispatchToTarget(ui::EventTarget* target) override;
182 ui::EventDispatchDetails PreDispatchEvent(ui::EventTarget* target, 186 ui::EventDispatchDetails PreDispatchEvent(ui::EventTarget* target,
183 ui::Event* event) override; 187 ui::Event* event) override;
184 ui::EventDispatchDetails PostDispatchEvent(ui::EventTarget* target, 188 ui::EventDispatchDetails PostDispatchEvent(ui::EventTarget* target,
185 const ui::Event& event) override; 189 const ui::Event& event) override;
186 190
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 259
256 // Set when dispatching a held event. 260 // Set when dispatching a held event.
257 ui::LocatedEvent* dispatching_held_event_; 261 ui::LocatedEvent* dispatching_held_event_;
258 262
259 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; 263 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_;
260 264
261 std::unique_ptr<EnvInputStateController> env_controller_; 265 std::unique_ptr<EnvInputStateController> env_controller_;
262 266
263 std::unique_ptr<MusMouseLocationUpdater> mus_mouse_location_updater_; 267 std::unique_ptr<MusMouseLocationUpdater> mus_mouse_location_updater_;
264 268
269 // The default EventTargeter for WindowEventDispatcher generated events.
270 std::unique_ptr<WindowTargeter> event_targeter_;
271
265 // Used to schedule reposting an event. 272 // Used to schedule reposting an event.
266 base::WeakPtrFactory<WindowEventDispatcher> repost_event_factory_; 273 base::WeakPtrFactory<WindowEventDispatcher> repost_event_factory_;
267 274
268 // Used to schedule DispatchHeldEvents() when |move_hold_count_| goes to 0. 275 // Used to schedule DispatchHeldEvents() when |move_hold_count_| goes to 0.
269 base::WeakPtrFactory<WindowEventDispatcher> held_event_factory_; 276 base::WeakPtrFactory<WindowEventDispatcher> held_event_factory_;
270 277
271 DISALLOW_COPY_AND_ASSIGN(WindowEventDispatcher); 278 DISALLOW_COPY_AND_ASSIGN(WindowEventDispatcher);
272 }; 279 };
273 280
274 } // namespace aura 281 } // namespace aura
275 282
276 #endif // UI_AURA_WINDOW_EVENT_DISPATCHER_H_ 283 #endif // UI_AURA_WINDOW_EVENT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « ui/aura/test/test_window_targeter.cc ('k') | ui/aura/window_event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698