[email protected] | 2374d181 | 2014-03-04 03:42:27 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
[email protected] | 81585f3 | 2011-07-29 19:32:06 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | fcc51c95 | 2014-02-21 21:31:26 | [diff] [blame] | 5 | #ifndef UI_AURA_WINDOW_EVENT_DISPATCHER_H_ |
| 6 | #define UI_AURA_WINDOW_EVENT_DISPATCHER_H_ |
[email protected] | 81585f3 | 2011-07-29 19:32:06 | [diff] [blame] | 7 | |
avi | 4ca29411 | 2015-12-24 08:04:09 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
danakj | 25c52c3 | 2016-04-12 21:51:08 | [diff] [blame] | 10 | #include <memory> |
[email protected] | 1266ba49 | 2012-05-16 23:29:48 | [diff] [blame] | 11 | #include <vector> |
| 12 | |
[email protected] | 379b0d6 | 2013-03-23 17:26:37 | [diff] [blame] | 13 | #include "base/gtest_prod_util.h" |
avi | 4ca29411 | 2015-12-24 08:04:09 | [diff] [blame] | 14 | #include "base/macros.h" |
[email protected] | 8d8953c | 2012-03-23 23:19:10 | [diff] [blame] | 15 | #include "base/memory/ref_counted.h" |
[email protected] | f296be7 | 2011-10-11 15:40:00 | [diff] [blame] | 16 | #include "base/memory/weak_ptr.h" |
[email protected] | 4e2d03e2 | 2013-07-18 04:19:54 | [diff] [blame] | 17 | #include "base/message_loop/message_loop.h" |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 18 | #include "base/scoped_observer.h" |
[email protected] | f94f0f1 | 2011-09-14 21:14:01 | [diff] [blame] | 19 | #include "ui/aura/aura_export.h" |
[email protected] | 60a978b7 | 2012-06-08 00:29:18 | [diff] [blame] | 20 | #include "ui/aura/client/capture_delegate.h" |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 21 | #include "ui/aura/env_observer.h" |
| 22 | #include "ui/aura/window_observer.h" |
[email protected] | c783955 | 2012-04-03 21:14:36 | [diff] [blame] | 23 | #include "ui/base/cursor/cursor.h" |
[email protected] | 86ccbd4 | 2013-09-18 18:11:54 | [diff] [blame] | 24 | #include "ui/events/event_constants.h" |
[email protected] | 8daeb41 | 2013-12-06 23:55:51 | [diff] [blame] | 25 | #include "ui/events/event_processor.h" |
| 26 | #include "ui/events/event_targeter.h" |
[email protected] | e5ae465 | 2013-09-25 00:36:27 | [diff] [blame] | 27 | #include "ui/events/gestures/gesture_recognizer.h" |
| 28 | #include "ui/events/gestures/gesture_types.h" |
tfarina | 655f81d | 2014-12-23 02:38:50 | [diff] [blame] | 29 | #include "ui/gfx/geometry/point.h" |
[email protected] | 81585f3 | 2011-07-29 19:32:06 | [diff] [blame] | 30 | #include "ui/gfx/native_widget_types.h" |
| 31 | |
| 32 | namespace gfx { |
| 33 | class Size; |
[email protected] | 0f0453e | 2012-10-14 18:15:35 | [diff] [blame] | 34 | class Transform; |
[email protected] | 81585f3 | 2011-07-29 19:32:06 | [diff] [blame] | 35 | } |
| 36 | |
[email protected] | 593ddfa | 2011-10-20 21:51:43 | [diff] [blame] | 37 | namespace ui { |
[email protected] | 2487bee4 | 2012-08-10 16:21:44 | [diff] [blame] | 38 | class GestureEvent; |
[email protected] | 81675c9 | 2012-04-05 22:14:49 | [diff] [blame] | 39 | class GestureRecognizer; |
[email protected] | ca706098 | 2012-08-08 18:05:25 | [diff] [blame] | 40 | class KeyEvent; |
[email protected] | ca706098 | 2012-08-08 18:05:25 | [diff] [blame] | 41 | class MouseEvent; |
| 42 | class ScrollEvent; |
[email protected] | 8ca8d246 | 2012-08-09 22:28:04 | [diff] [blame] | 43 | class TouchEvent; |
[email protected] | 593ddfa | 2011-10-20 21:51:43 | [diff] [blame] | 44 | } |
| 45 | |
[email protected] | 81585f3 | 2011-07-29 19:32:06 | [diff] [blame] | 46 | namespace aura { |
[email protected] | 778ee20 | 2013-09-25 17:56:10 | [diff] [blame] | 47 | class TestScreen; |
[email protected] | 8daeb41 | 2013-12-06 23:55:51 | [diff] [blame] | 48 | class WindowTargeter; |
[email protected] | 7a60cd3a | 2014-03-20 20:54:57 | [diff] [blame] | 49 | class WindowTreeHost; |
[email protected] | b1b15551 | 2011-08-18 22:47:50 | [diff] [blame] | 50 | |
[email protected] | 6b6147475 | 2014-06-27 17:37:07 | [diff] [blame] | 51 | namespace test { |
| 52 | class WindowEventDispatcherTestApi; |
| 53 | } |
| 54 | |
[email protected] | 2374d181 | 2014-03-04 03:42:27 | [diff] [blame] | 55 | // WindowEventDispatcher orchestrates event dispatch within a window tree |
| 56 | // owned by WindowTreeHost. WTH also owns the WED. |
| 57 | // TODO(beng): In progress, remove functionality not directly related to |
| 58 | // event dispatch. |
[email protected] | 056ce05 | 2014-02-21 05:19:32 | [diff] [blame] | 59 | class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, |
| 60 | public ui::GestureEventHelper, |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 61 | public client::CaptureDelegate, |
| 62 | public WindowObserver, |
| 63 | public EnvObserver { |
[email protected] | 81585f3 | 2011-07-29 19:32:06 | [diff] [blame] | 64 | public: |
[email protected] | 2f262033 | 2014-02-28 10:07:38 | [diff] [blame] | 65 | explicit WindowEventDispatcher(WindowTreeHost* host); |
dcheng | 5bdeb6b | 2014-10-27 20:58:05 | [diff] [blame] | 66 | ~WindowEventDispatcher() override; |
[email protected] | 9ed496e | 2011-10-18 23:47:39 | [diff] [blame] | 67 | |
sky | 05111cd | 2015-11-16 22:41:57 | [diff] [blame] | 68 | void set_transform_events(bool value) { transform_events_ = value; } |
| 69 | |
[email protected] | 9ed496e | 2011-10-18 23:47:39 | [diff] [blame] | 70 | Window* mouse_pressed_handler() { return mouse_pressed_handler_; } |
[email protected] | 23a2dc8d | 2013-08-22 15:04:22 | [diff] [blame] | 71 | Window* mouse_moved_handler() { return mouse_moved_handler_; } |
[email protected] | a857dbe | 2012-05-30 22:10:14 | [diff] [blame] | 72 | |
[email protected] | 5c95ee47 | 2013-03-15 16:55:27 | [diff] [blame] | 73 | // Repost event for re-processing. Used when exiting context menus. |
ananta | 5750886 | 2016-01-14 21:54:42 | [diff] [blame] | 74 | // We support the ET_MOUSE_PRESSED, ET_TOUCH_PRESSED and ET_GESTURE_TAP_DOWN |
| 75 | // event types (although the latter is currently a no-op). |
| 76 | void RepostEvent(const ui::LocatedEvent* event); |
[email protected] | 5c95ee47 | 2013-03-15 16:55:27 | [diff] [blame] | 77 | |
[email protected] | 166ccde | 2012-12-19 16:43:53 | [diff] [blame] | 78 | // Invoked when the mouse events get enabled or disabled. |
| 79 | void OnMouseEventsEnableStateChanged(bool enabled); |
| 80 | |
[email protected] | d04aca19 | 2014-03-07 05:00:17 | [diff] [blame] | 81 | void DispatchCancelModeEvent(); |
| 82 | |
myid.shin | 50bcf1b | 2015-01-08 02:42:17 | [diff] [blame] | 83 | // Dispatches a ui::ET_MOUSE_EXITED event at |point| to the |target| |
| 84 | // If the |target| is NULL, we will dispatch the event to the root-window |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 85 | // TODO(beng): needed only for WTH::OnCursorVisibilityChanged(). |
myid.shin | 50bcf1b | 2015-01-08 02:42:17 | [diff] [blame] | 86 | ui::EventDispatchDetails DispatchMouseExitAtPoint(Window* target, |
| 87 | const gfx::Point& point) |
| 88 | WARN_UNUSED_RESULT; |
[email protected] | 450edc67 | 2013-09-20 15:29:59 | [diff] [blame] | 89 | |
[email protected] | 4aeda579 | 2012-01-26 20:38:42 | [diff] [blame] | 90 | // Gesture Recognition ------------------------------------------------------- |
| 91 | |
[email protected] | 9bc2755 | 2012-10-17 21:02:51 | [diff] [blame] | 92 | // When a touch event is dispatched to a Window, it may want to process the |
| 93 | // touch event asynchronously. In such cases, the window should consume the |
| 94 | // event during the event dispatch. Once the event is properly processed, the |
[email protected] | 056ce05 | 2014-02-21 05:19:32 | [diff] [blame] | 95 | // window should let the WindowEventDispatcher know about the result of the |
| 96 | // event processing, so that gesture events can be properly created and |
tdresser | b6387c5 | 2014-09-10 20:39:49 | [diff] [blame] | 97 | // dispatched. |event|'s location should be in the dispatcher's coordinate |
| 98 | // space, in DIPs. |
avi | 4ca29411 | 2015-12-24 08:04:09 | [diff] [blame] | 99 | virtual void ProcessedTouchEvent(uint32_t unique_event_id, |
lanwei | c67620d | 2015-05-25 17:24:54 | [diff] [blame] | 100 | Window* window, |
| 101 | ui::EventResult result); |
[email protected] | 4aeda579 | 2012-01-26 20:38:42 | [diff] [blame] | 102 | |
[email protected] | a1f064d | 2013-06-11 18:58:54 | [diff] [blame] | 103 | // These methods are used to defer the processing of mouse/touch events |
| 104 | // related to resize. A client (typically a RenderWidgetHostViewAura) can call |
| 105 | // HoldPointerMoves when an resize is initiated and then ReleasePointerMoves |
[email protected] | 308aaa3 | 2012-03-12 13:14:50 | [diff] [blame] | 106 | // once the resize is completed. |
| 107 | // |
| 108 | // More than one hold can be invoked and each hold must be cancelled by a |
| 109 | // release before we resume normal operation. |
[email protected] | a1f064d | 2013-06-11 18:58:54 | [diff] [blame] | 110 | void HoldPointerMoves(); |
| 111 | void ReleasePointerMoves(); |
[email protected] | 308aaa3 | 2012-03-12 13:14:50 | [diff] [blame] | 112 | |
[email protected] | 718b26c | 2012-07-24 20:53:23 | [diff] [blame] | 113 | // Gets the last location seen in a mouse event in this root window's |
| 114 | // coordinates. This may return a point outside the root window's bounds. |
| 115 | gfx::Point GetLastMouseLocationInRoot() const; |
| 116 | |
[email protected] | c178471 | 2014-07-23 14:19:39 | [diff] [blame] | 117 | void OnHostLostMouseGrab(); |
[email protected] | d04aca19 | 2014-03-07 05:00:17 | [diff] [blame] | 118 | void OnCursorMovedToRootLocation(const gfx::Point& root_location); |
| 119 | |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 120 | // TODO(beng): This is only needed because this cleanup needs to happen after |
| 121 | // all other observers are notified of OnWindowDestroying() but |
| 122 | // before OnWindowDestroyed() is sent (i.e. while the window |
| 123 | // hierarchy is still intact). This didn't seem worth adding a |
| 124 | // generic notification for as only this class needs to implement |
| 125 | // it. I would however like to find a way to do this via an |
| 126 | // observer. |
| 127 | void OnPostNotifiedWindowDestroying(Window* window); |
| 128 | |
[email protected] | 72eb1cf | 2012-01-31 23:31:11 | [diff] [blame] | 129 | private: |
[email protected] | 056ce05 | 2014-02-21 05:19:32 | [diff] [blame] | 130 | FRIEND_TEST_ALL_PREFIXES(WindowEventDispatcherTest, |
| 131 | KeepTranslatedEventInRoot); |
[email protected] | 379b0d6 | 2013-03-23 17:26:37 | [diff] [blame] | 132 | |
[email protected] | 6b6147475 | 2014-06-27 17:37:07 | [diff] [blame] | 133 | friend class test::WindowEventDispatcherTestApi; |
[email protected] | 16690b0 | 2012-02-01 04:06:35 | [diff] [blame] | 134 | friend class Window; |
[email protected] | 046cd7c | 2013-03-08 13:52:43 | [diff] [blame] | 135 | friend class TestScreen; |
[email protected] | 16690b0 | 2012-02-01 04:06:35 | [diff] [blame] | 136 | |
[email protected] | 2e98aaf7 | 2012-11-08 06:30:59 | [diff] [blame] | 137 | // The parameter for OnWindowHidden() to specify why window is hidden. |
| 138 | enum WindowHiddenReason { |
| 139 | WINDOW_DESTROYED, // Window is destroyed. |
| 140 | WINDOW_HIDDEN, // Window is hidden. |
| 141 | WINDOW_MOVING, // Window is temporarily marked as hidden due to move |
| 142 | // across root windows. |
| 143 | }; |
| 144 | |
[email protected] | 7a60cd3a | 2014-03-20 20:54:57 | [diff] [blame] | 145 | Window* window(); |
| 146 | const Window* window() const; |
| 147 | |
[email protected] | 49d7c1d | 2012-11-15 17:08:08 | [diff] [blame] | 148 | // Updates the event with the appropriate transform for the device scale |
[email protected] | d04aca19 | 2014-03-07 05:00:17 | [diff] [blame] | 149 | // factor. The WindowEventDispatcher dispatches events in the physical pixel |
[email protected] | 056ce05 | 2014-02-21 05:19:32 | [diff] [blame] | 150 | // coordinate. But the event processing from WindowEventDispatcher onwards |
| 151 | // happen in device-independent pixel coordinate. So it is necessary to update |
| 152 | // the event received from the host. |
[email protected] | 95aa489a | 2013-07-08 15:30:23 | [diff] [blame] | 153 | void TransformEventForDeviceScaleFactor(ui::LocatedEvent* event); |
[email protected] | 49d7c1d | 2012-11-15 17:08:08 | [diff] [blame] | 154 | |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 155 | // Dispatches OnMouseExited to the |window| which is hiding if necessary. |
| 156 | void DispatchMouseExitToHidingWindow(Window* window); |
| 157 | |
[email protected] | fe9eec1 | 2013-01-28 21:57:33 | [diff] [blame] | 158 | // Dispatches the specified event type (intended for enter/exit) to the |
| 159 | // |mouse_moved_handler_|. |
myid.shin | 50bcf1b | 2015-01-08 02:42:17 | [diff] [blame] | 160 | // The event's location will be converted from |target|coordinate system to |
| 161 | // |mouse_moved_handler_| coordinate system. |
| 162 | ui::EventDispatchDetails DispatchMouseEnterOrExit(Window* target, |
| 163 | const ui::MouseEvent& event, |
| 164 | ui::EventType type) |
| 165 | WARN_UNUSED_RESULT; |
[email protected] | ddb5ec5 | 2013-11-08 05:22:03 | [diff] [blame] | 166 | ui::EventDispatchDetails ProcessGestures( |
dtapuska | 8aba1907 | 2015-12-22 20:38:04 | [diff] [blame] | 167 | Window* target, |
[email protected] | ddb5ec5 | 2013-11-08 05:22:03 | [diff] [blame] | 168 | ui::GestureRecognizer::Gestures* gestures) WARN_UNUSED_RESULT; |
[email protected] | ea2a867a | 2011-10-26 17:41:33 | [diff] [blame] | 169 | |
[email protected] | a278e260 | 2012-02-16 16:46:35 | [diff] [blame] | 170 | // Called when a window becomes invisible, either by being removed |
[email protected] | 052305f | 2012-12-05 18:53:04 | [diff] [blame] | 171 | // from root window hierarchy, via SetVisible(false) or being destroyed. |
[email protected] | 727f6a1 | 2014-02-06 01:43:58 | [diff] [blame] | 172 | // |reason| specifies what triggered the hiding. Note that becoming invisible |
| 173 | // will cause a window to lose capture and some windows may destroy themselves |
| 174 | // on capture (like DragDropTracker). |
[email protected] | 6184d10f | 2013-08-06 07:57:07 | [diff] [blame] | 175 | void OnWindowHidden(Window* invisible, WindowHiddenReason reason); |
[email protected] | a278e260 | 2012-02-16 16:46:35 | [diff] [blame] | 176 | |
Sadrul Habib Chowdhury | d91358f | 2015-03-13 02:08:33 | [diff] [blame] | 177 | bool is_dispatched_held_event(const ui::Event& event) const; |
| 178 | |
[email protected] | efdb40c | 2013-10-18 22:24:19 | [diff] [blame] | 179 | // Overridden from aura::client::CaptureDelegate: |
dcheng | 5bdeb6b | 2014-10-27 20:58:05 | [diff] [blame] | 180 | void UpdateCapture(Window* old_capture, Window* new_capture) override; |
| 181 | void OnOtherRootGotCapture() override; |
| 182 | void SetNativeCapture() override; |
| 183 | void ReleaseNativeCapture() override; |
[email protected] | efdb40c | 2013-10-18 22:24:19 | [diff] [blame] | 184 | |
[email protected] | 8daeb41 | 2013-12-06 23:55:51 | [diff] [blame] | 185 | // Overridden from ui::EventProcessor: |
dcheng | 5bdeb6b | 2014-10-27 20:58:05 | [diff] [blame] | 186 | ui::EventTarget* GetRootTarget() override; |
| 187 | void OnEventProcessingStarted(ui::Event* event) override; |
[email protected] | 8daeb41 | 2013-12-06 23:55:51 | [diff] [blame] | 188 | |
[email protected] | 4d8784a7 | 2012-12-06 22:45:41 | [diff] [blame] | 189 | // Overridden from ui::EventDispatcherDelegate. |
dcheng | 5bdeb6b | 2014-10-27 20:58:05 | [diff] [blame] | 190 | bool CanDispatchToTarget(ui::EventTarget* target) override; |
| 191 | ui::EventDispatchDetails PreDispatchEvent(ui::EventTarget* target, |
| 192 | ui::Event* event) override; |
| 193 | ui::EventDispatchDetails PostDispatchEvent(ui::EventTarget* target, |
| 194 | const ui::Event& event) override; |
[email protected] | ab6cbed0 | 2012-09-03 13:20:04 | [diff] [blame] | 195 | |
[email protected] | 81675c9 | 2012-04-05 22:14:49 | [diff] [blame] | 196 | // Overridden from ui::GestureEventHelper. |
dcheng | 5bdeb6b | 2014-10-27 20:58:05 | [diff] [blame] | 197 | bool CanDispatchToConsumer(ui::GestureConsumer* consumer) override; |
dtapuska | 8aba1907 | 2015-12-22 20:38:04 | [diff] [blame] | 198 | void DispatchGestureEvent(ui::GestureConsumer* raw_input_consumer, |
| 199 | ui::GestureEvent* event) override; |
| 200 | void DispatchCancelTouchEvent(ui::GestureConsumer* raw_input_consumer, |
| 201 | ui::TouchEvent* event) override; |
[email protected] | 81675c9 | 2012-04-05 22:14:49 | [diff] [blame] | 202 | |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 203 | // Overridden from WindowObserver: |
dcheng | 5bdeb6b | 2014-10-27 20:58:05 | [diff] [blame] | 204 | void OnWindowDestroying(Window* window) override; |
| 205 | void OnWindowDestroyed(Window* window) override; |
| 206 | void OnWindowAddedToRootWindow(Window* window) override; |
| 207 | void OnWindowRemovingFromRootWindow(Window* window, |
| 208 | Window* new_root) override; |
| 209 | void OnWindowVisibilityChanging(Window* window, bool visible) override; |
| 210 | void OnWindowVisibilityChanged(Window* window, bool visible) override; |
| 211 | void OnWindowBoundsChanged(Window* window, |
| 212 | const gfx::Rect& old_bounds, |
| 213 | const gfx::Rect& new_bounds) override; |
| 214 | void OnWindowTransforming(Window* window) override; |
| 215 | void OnWindowTransformed(Window* window) override; |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 216 | |
| 217 | // Overridden from EnvObserver: |
dcheng | 5bdeb6b | 2014-10-27 20:58:05 | [diff] [blame] | 218 | void OnWindowInitialized(Window* window) override; |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 219 | |
[email protected] | a1f064d | 2013-06-11 18:58:54 | [diff] [blame] | 220 | // We hold and aggregate mouse drags and touch moves as a way of throttling |
| 221 | // resizes when HoldMouseMoves() is called. The following methods are used to |
| 222 | // dispatch held and newly incoming mouse and touch events, typically when an |
| 223 | // event other than one of these needs dispatching or a matching |
| 224 | // ReleaseMouseMoves()/ReleaseTouchMoves() is called. NOTE: because these |
[email protected] | 641dcfd | 2014-01-08 16:41:23 | [diff] [blame] | 225 | // methods dispatch events from WindowTreeHost the coordinates are in terms of |
[email protected] | a1f064d | 2013-06-11 18:58:54 | [diff] [blame] | 226 | // the root. |
[email protected] | ddb5ec5 | 2013-11-08 05:22:03 | [diff] [blame] | 227 | ui::EventDispatchDetails DispatchHeldEvents() WARN_UNUSED_RESULT; |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 228 | |
| 229 | // Posts a task to send synthesized mouse move event if there is no a pending |
| 230 | // task. |
[email protected] | b1609ea9 | 2014-04-30 10:30:33 | [diff] [blame] | 231 | void PostSynthesizeMouseMove(); |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 232 | |
[email protected] | b1609ea9 | 2014-04-30 10:30:33 | [diff] [blame] | 233 | // Creates and dispatches synthesized mouse move event using the current mouse |
| 234 | // location. |
| 235 | ui::EventDispatchDetails SynthesizeMouseMoveEvent() WARN_UNUSED_RESULT; |
[email protected] | ddb5ec5 | 2013-11-08 05:22:03 | [diff] [blame] | 236 | |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 237 | // Calls SynthesizeMouseMove() if |window| is currently visible and contains |
| 238 | // the mouse cursor. |
| 239 | void SynthesizeMouseMoveAfterChangeToWindow(Window* window); |
[email protected] | 539a8af | 2012-01-27 20:12:14 | [diff] [blame] | 240 | |
mohsen | a35220488 | 2015-11-06 01:57:49 | [diff] [blame] | 241 | ui::EventDispatchDetails PreDispatchLocatedEvent(Window* target, |
| 242 | ui::LocatedEvent* event); |
| 243 | ui::EventDispatchDetails PreDispatchMouseEvent(Window* target, |
| 244 | ui::MouseEvent* event); |
| 245 | ui::EventDispatchDetails PreDispatchTouchEvent(Window* target, |
| 246 | ui::TouchEvent* event); |
[email protected] | 4c5d7c9 | 2013-12-13 17:17:39 | [diff] [blame] | 247 | |
[email protected] | 2f262033 | 2014-02-28 10:07:38 | [diff] [blame] | 248 | WindowTreeHost* host_; |
[email protected] | 8d8c773 | 2011-08-25 22:35:13 | [diff] [blame] | 249 | |
[email protected] | 23d94a60 | 2012-05-31 22:21:40 | [diff] [blame] | 250 | // Touch ids that are currently down. |
avi | 4ca29411 | 2015-12-24 08:04:09 | [diff] [blame] | 251 | uint32_t touch_ids_down_; |
[email protected] | 23d94a60 | 2012-05-31 22:21:40 | [diff] [blame] | 252 | |
[email protected] | 114bfbd | 2011-10-18 21:20:24 | [diff] [blame] | 253 | Window* mouse_pressed_handler_; |
| 254 | Window* mouse_moved_handler_; |
[email protected] | ab6cbed0 | 2012-09-03 13:20:04 | [diff] [blame] | 255 | Window* event_dispatch_target_; |
[email protected] | 8daeb41 | 2013-12-06 23:55:51 | [diff] [blame] | 256 | Window* old_dispatch_target_; |
[email protected] | 912b6f3 | 2012-01-19 00:48:01 | [diff] [blame] | 257 | |
[email protected] | 539a8af | 2012-01-27 20:12:14 | [diff] [blame] | 258 | bool synthesize_mouse_move_; |
[email protected] | 308aaa3 | 2012-03-12 13:14:50 | [diff] [blame] | 259 | |
[email protected] | a1f064d | 2013-06-11 18:58:54 | [diff] [blame] | 260 | // How many move holds are outstanding. We try to defer dispatching |
| 261 | // touch/mouse moves while the count is > 0. |
| 262 | int move_hold_count_; |
[email protected] | 48f19de | 2014-01-13 18:20:38 | [diff] [blame] | 263 | // The location of |held_move_event_| is in |window_|'s coordinate. |
danakj | 25c52c3 | 2016-04-12 21:51:08 | [diff] [blame] | 264 | std::unique_ptr<ui::LocatedEvent> held_move_event_; |
[email protected] | 5c95ee47 | 2013-03-15 16:55:27 | [diff] [blame] | 265 | |
| 266 | // Allowing for reposting of events. Used when exiting context menus. |
danakj | 25c52c3 | 2016-04-12 21:51:08 | [diff] [blame] | 267 | std::unique_ptr<ui::LocatedEvent> held_repostable_event_; |
[email protected] | 308aaa3 | 2012-03-12 13:14:50 | [diff] [blame] | 268 | |
[email protected] | 4c5d7c9 | 2013-12-13 17:17:39 | [diff] [blame] | 269 | // Set when dispatching a held event. |
Sadrul Habib Chowdhury | 9af9ccd | 2015-01-15 13:05:28 | [diff] [blame] | 270 | ui::LocatedEvent* dispatching_held_event_; |
[email protected] | 4c5d7c9 | 2013-12-13 17:17:39 | [diff] [blame] | 271 | |
[email protected] | 29cf75e | 2014-03-21 20:48:45 | [diff] [blame] | 272 | ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; |
| 273 | |
sky | 05111cd | 2015-11-16 22:41:57 | [diff] [blame] | 274 | bool transform_events_; |
| 275 | |
[email protected] | ddb5ec5 | 2013-11-08 05:22:03 | [diff] [blame] | 276 | // Used to schedule reposting an event. |
[email protected] | 056ce05 | 2014-02-21 05:19:32 | [diff] [blame] | 277 | base::WeakPtrFactory<WindowEventDispatcher> repost_event_factory_; |
[email protected] | 07f0f2cf | 2013-10-09 03:43:18 | [diff] [blame] | 278 | |
| 279 | // Used to schedule DispatchHeldEvents() when |move_hold_count_| goes to 0. |
[email protected] | 056ce05 | 2014-02-21 05:19:32 | [diff] [blame] | 280 | base::WeakPtrFactory<WindowEventDispatcher> held_event_factory_; |
[email protected] | 07f0f2cf | 2013-10-09 03:43:18 | [diff] [blame] | 281 | |
[email protected] | 056ce05 | 2014-02-21 05:19:32 | [diff] [blame] | 282 | DISALLOW_COPY_AND_ASSIGN(WindowEventDispatcher); |
[email protected] | 81585f3 | 2011-07-29 19:32:06 | [diff] [blame] | 283 | }; |
| 284 | |
| 285 | } // namespace aura |
| 286 | |
[email protected] | fcc51c95 | 2014-02-21 21:31:26 | [diff] [blame] | 287 | #endif // UI_AURA_WINDOW_EVENT_DISPATCHER_H_ |