OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 | 75 |
76 size_t size() const { | 76 size_t size() const { |
77 return touch_queue_.size(); | 77 return touch_queue_.size(); |
78 } | 78 } |
79 | 79 |
80 bool ack_timeout_enabled() const { | 80 bool ack_timeout_enabled() const { |
81 return ack_timeout_enabled_; | 81 return ack_timeout_enabled_; |
82 } | 82 } |
83 | 83 |
84 bool has_handlers() const { | 84 bool has_handlers() const { |
85 return has_handlers_; | 85 return touch_handling_state_ != NO_TOUCH_HANDLER; |
86 } | 86 } |
87 | 87 |
88 private: | 88 private: |
89 class TouchTimeoutHandler; | 89 class TouchTimeoutHandler; |
90 friend class TouchTimeoutHandler; | 90 friend class TouchTimeoutHandler; |
91 friend class TouchEventQueueTest; | 91 friend class TouchEventQueueTest; |
92 | 92 |
93 bool HasTimeoutEvent() const; | 93 bool HasTimeoutEvent() const; |
94 bool IsTimeoutRunningForTesting() const; | 94 bool IsTimeoutRunningForTesting() const; |
95 const TouchEventWithLatencyInfo& GetLatestEventForTesting() const; | 95 const TouchEventWithLatencyInfo& GetLatestEventForTesting() const; |
(...skipping 30 matching lines...) Expand all Loading... | |
126 | 126 |
127 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|. | 127 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|. |
128 // If not NULL, |dispatching_touch_ack_| is the touch event of which the ack | 128 // If not NULL, |dispatching_touch_ack_| is the touch event of which the ack |
129 // is being dispatched. | 129 // is being dispatched. |
130 CoalescedWebTouchEvent* dispatching_touch_ack_; | 130 CoalescedWebTouchEvent* dispatching_touch_ack_; |
131 | 131 |
132 // Used to prevent touch timeout scheduling if we receive a synchronous | 132 // Used to prevent touch timeout scheduling if we receive a synchronous |
133 // ack after forwarding a touch event to the client. | 133 // ack after forwarding a touch event to the client. |
134 bool dispatching_touch_; | 134 bool dispatching_touch_; |
135 | 135 |
136 // Whether there are any registered touch handlers. Defaults to false. | 136 // Determines touch event forwarding decisions. |
Rick Byers
2014/01/21 22:00:25
I like collapsing the bits into a single enum! I
jdduke (slow)
2014/01/22 02:47:00
That sounds just fine :) And I agree, using the te
| |
137 bool has_handlers_; | 137 enum TouchHandlingState { |
138 | 138 HAS_TOUCH_HANDLER, // All events forwarded. |
139 // Don't send touch events to the renderer while scrolling. | 139 NO_TOUCH_HANDLER, // No events forwarded. |
140 bool scroll_in_progress_; | 140 NO_TOUCH_HANDLER_FOR_GESTURE, // No more events in the sequence forwarded. |
141 | 141 RENDERER_CONSUMING_GESTURE, // All events in the sequence forwarded. |
142 // Whether an event in the current (multi)touch sequence was consumed by the | 142 TOUCH_HANDLING_STATE_DEFAULT = NO_TOUCH_HANDLER, |
143 // renderer. The touch timeout will never be activated when this is true. | 143 }; |
144 bool renderer_is_consuming_touch_gesture_; | 144 TouchHandlingState touch_handling_state_; |
145 | 145 |
146 // Optional handler for timed-out touch event acks, disabled by default. | 146 // Optional handler for timed-out touch event acks, disabled by default. |
147 bool ack_timeout_enabled_; | 147 bool ack_timeout_enabled_; |
148 scoped_ptr<TouchTimeoutHandler> timeout_handler_; | 148 scoped_ptr<TouchTimeoutHandler> timeout_handler_; |
149 | 149 |
150 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); | 150 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); |
151 }; | 151 }; |
152 | 152 |
153 } // namespace content | 153 } // namespace content |
154 | 154 |
155 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 155 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
OLD | NEW |