OLD | NEW |
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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // owned by WindowTreeHost. WTH also owns the WED. | 54 // owned by WindowTreeHost. WTH also owns the WED. |
55 // TODO(beng): In progress, remove functionality not directly related to | 55 // TODO(beng): In progress, remove functionality not directly related to |
56 // event dispatch. | 56 // event dispatch. |
57 class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, | 57 class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, |
58 public ui::GestureEventHelper, | 58 public ui::GestureEventHelper, |
59 public client::CaptureDelegate, | 59 public client::CaptureDelegate, |
60 public WindowObserver, | 60 public WindowObserver, |
61 public EnvObserver { | 61 public EnvObserver { |
62 public: | 62 public: |
63 explicit WindowEventDispatcher(WindowTreeHost* host); | 63 explicit WindowEventDispatcher(WindowTreeHost* host); |
64 virtual ~WindowEventDispatcher(); | 64 ~WindowEventDispatcher() override; |
65 | 65 |
66 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } | 66 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } |
67 Window* mouse_moved_handler() { return mouse_moved_handler_; } | 67 Window* mouse_moved_handler() { return mouse_moved_handler_; } |
68 | 68 |
69 // Repost event for re-processing. Used when exiting context menus. | 69 // Repost event for re-processing. Used when exiting context menus. |
70 // We only support the ET_MOUSE_PRESSED and ET_GESTURE_TAP_DOWN event | 70 // We only support the ET_MOUSE_PRESSED and ET_GESTURE_TAP_DOWN event |
71 // types (although the latter is currently a no-op). | 71 // types (although the latter is currently a no-op). |
72 void RepostEvent(const ui::LocatedEvent& event); | 72 void RepostEvent(const ui::LocatedEvent& event); |
73 | 73 |
74 // Invoked when the mouse events get enabled or disabled. | 74 // Invoked when the mouse events get enabled or disabled. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // from root window hierarchy, via SetVisible(false) or being destroyed. | 161 // from root window hierarchy, via SetVisible(false) or being destroyed. |
162 // |reason| specifies what triggered the hiding. Note that becoming invisible | 162 // |reason| specifies what triggered the hiding. Note that becoming invisible |
163 // will cause a window to lose capture and some windows may destroy themselves | 163 // will cause a window to lose capture and some windows may destroy themselves |
164 // on capture (like DragDropTracker). | 164 // on capture (like DragDropTracker). |
165 void OnWindowHidden(Window* invisible, WindowHiddenReason reason); | 165 void OnWindowHidden(Window* invisible, WindowHiddenReason reason); |
166 | 166 |
167 // Returns a target window for the given gesture event. | 167 // Returns a target window for the given gesture event. |
168 Window* GetGestureTarget(ui::GestureEvent* event); | 168 Window* GetGestureTarget(ui::GestureEvent* event); |
169 | 169 |
170 // Overridden from aura::client::CaptureDelegate: | 170 // Overridden from aura::client::CaptureDelegate: |
171 virtual void UpdateCapture(Window* old_capture, Window* new_capture) override; | 171 void UpdateCapture(Window* old_capture, Window* new_capture) override; |
172 virtual void OnOtherRootGotCapture() override; | 172 void OnOtherRootGotCapture() override; |
173 virtual void SetNativeCapture() override; | 173 void SetNativeCapture() override; |
174 virtual void ReleaseNativeCapture() override; | 174 void ReleaseNativeCapture() override; |
175 | 175 |
176 // Overridden from ui::EventProcessor: | 176 // Overridden from ui::EventProcessor: |
177 virtual ui::EventTarget* GetRootTarget() override; | 177 ui::EventTarget* GetRootTarget() override; |
178 virtual void OnEventProcessingStarted(ui::Event* event) override; | 178 void OnEventProcessingStarted(ui::Event* event) override; |
179 | 179 |
180 // Overridden from ui::EventDispatcherDelegate. | 180 // Overridden from ui::EventDispatcherDelegate. |
181 virtual bool CanDispatchToTarget(ui::EventTarget* target) override; | 181 bool CanDispatchToTarget(ui::EventTarget* target) override; |
182 virtual ui::EventDispatchDetails PreDispatchEvent(ui::EventTarget* target, | 182 ui::EventDispatchDetails PreDispatchEvent(ui::EventTarget* target, |
183 ui::Event* event) override; | 183 ui::Event* event) override; |
184 virtual ui::EventDispatchDetails PostDispatchEvent( | 184 ui::EventDispatchDetails PostDispatchEvent(ui::EventTarget* target, |
185 ui::EventTarget* target, const ui::Event& event) override; | 185 const ui::Event& event) override; |
186 | 186 |
187 // Overridden from ui::GestureEventHelper. | 187 // Overridden from ui::GestureEventHelper. |
188 virtual bool CanDispatchToConsumer(ui::GestureConsumer* consumer) override; | 188 bool CanDispatchToConsumer(ui::GestureConsumer* consumer) override; |
189 virtual void DispatchGestureEvent(ui::GestureEvent* event) override; | 189 void DispatchGestureEvent(ui::GestureEvent* event) override; |
190 virtual void DispatchCancelTouchEvent(ui::TouchEvent* event) override; | 190 void DispatchCancelTouchEvent(ui::TouchEvent* event) override; |
191 | 191 |
192 // Overridden from WindowObserver: | 192 // Overridden from WindowObserver: |
193 virtual void OnWindowDestroying(Window* window) override; | 193 void OnWindowDestroying(Window* window) override; |
194 virtual void OnWindowDestroyed(Window* window) override; | 194 void OnWindowDestroyed(Window* window) override; |
195 virtual void OnWindowAddedToRootWindow(Window* window) override; | 195 void OnWindowAddedToRootWindow(Window* window) override; |
196 virtual void OnWindowRemovingFromRootWindow(Window* window, | 196 void OnWindowRemovingFromRootWindow(Window* window, |
197 Window* new_root) override; | 197 Window* new_root) override; |
198 virtual void OnWindowVisibilityChanging(Window* window, | 198 void OnWindowVisibilityChanging(Window* window, bool visible) override; |
199 bool visible) override; | 199 void OnWindowVisibilityChanged(Window* window, bool visible) override; |
200 virtual void OnWindowVisibilityChanged(Window* window, bool visible) override; | 200 void OnWindowBoundsChanged(Window* window, |
201 virtual void OnWindowBoundsChanged(Window* window, | 201 const gfx::Rect& old_bounds, |
202 const gfx::Rect& old_bounds, | 202 const gfx::Rect& new_bounds) override; |
203 const gfx::Rect& new_bounds) override; | 203 void OnWindowTransforming(Window* window) override; |
204 virtual void OnWindowTransforming(Window* window) override; | 204 void OnWindowTransformed(Window* window) override; |
205 virtual void OnWindowTransformed(Window* window) override; | |
206 | 205 |
207 // Overridden from EnvObserver: | 206 // Overridden from EnvObserver: |
208 virtual void OnWindowInitialized(Window* window) override; | 207 void OnWindowInitialized(Window* window) override; |
209 | 208 |
210 // We hold and aggregate mouse drags and touch moves as a way of throttling | 209 // We hold and aggregate mouse drags and touch moves as a way of throttling |
211 // resizes when HoldMouseMoves() is called. The following methods are used to | 210 // resizes when HoldMouseMoves() is called. The following methods are used to |
212 // dispatch held and newly incoming mouse and touch events, typically when an | 211 // dispatch held and newly incoming mouse and touch events, typically when an |
213 // event other than one of these needs dispatching or a matching | 212 // event other than one of these needs dispatching or a matching |
214 // ReleaseMouseMoves()/ReleaseTouchMoves() is called. NOTE: because these | 213 // ReleaseMouseMoves()/ReleaseTouchMoves() is called. NOTE: because these |
215 // methods dispatch events from WindowTreeHost the coordinates are in terms of | 214 // methods dispatch events from WindowTreeHost the coordinates are in terms of |
216 // the root. | 215 // the root. |
217 ui::EventDispatchDetails DispatchHeldEvents() WARN_UNUSED_RESULT; | 216 ui::EventDispatchDetails DispatchHeldEvents() WARN_UNUSED_RESULT; |
218 | 217 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 262 |
264 // Used to schedule DispatchHeldEvents() when |move_hold_count_| goes to 0. | 263 // Used to schedule DispatchHeldEvents() when |move_hold_count_| goes to 0. |
265 base::WeakPtrFactory<WindowEventDispatcher> held_event_factory_; | 264 base::WeakPtrFactory<WindowEventDispatcher> held_event_factory_; |
266 | 265 |
267 DISALLOW_COPY_AND_ASSIGN(WindowEventDispatcher); | 266 DISALLOW_COPY_AND_ASSIGN(WindowEventDispatcher); |
268 }; | 267 }; |
269 | 268 |
270 } // namespace aura | 269 } // namespace aura |
271 | 270 |
272 #endif // UI_AURA_WINDOW_EVENT_DISPATCHER_H_ | 271 #endif // UI_AURA_WINDOW_EVENT_DISPATCHER_H_ |
OLD | NEW |