| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // resume the normal flow of sending touch events to the renderer. | 99 // resume the normal flow of sending touch events to the renderer. |
| 100 void OnGestureScrollEvent(const GestureEventWithLatencyInfo& gesture_event); | 100 void OnGestureScrollEvent(const GestureEventWithLatencyInfo& gesture_event); |
| 101 | 101 |
| 102 void OnGestureEventAck( | 102 void OnGestureEventAck( |
| 103 const GestureEventWithLatencyInfo& event, | 103 const GestureEventWithLatencyInfo& event, |
| 104 InputEventAckState ack_result); | 104 InputEventAckState ack_result); |
| 105 | 105 |
| 106 // Notifies the queue whether the renderer has at least one touch handler. | 106 // Notifies the queue whether the renderer has at least one touch handler. |
| 107 void OnHasTouchEventHandlers(bool has_handlers); | 107 void OnHasTouchEventHandlers(bool has_handlers); |
| 108 | 108 |
| 109 // Empties the queue of touch events, ack'ing each in turn with |ack_state|. |
| 110 // This may result in any number of gesture events being sent to the renderer. |
| 111 void Flush(InputEventAckState flush_ack); |
| 112 |
| 109 // Returns whether the currently pending touch event (waiting ACK) is for | 113 // Returns whether the currently pending touch event (waiting ACK) is for |
| 110 // a touch start event. | 114 // a touch start event. |
| 111 bool IsPendingAckTouchStart() const; | 115 bool IsPendingAckTouchStart() const; |
| 112 | 116 |
| 113 // Sets whether a delayed touch ack will cancel and flush the current | 117 // Sets whether a delayed touch ack will cancel and flush the current |
| 114 // touch sequence. Note that, if the timeout was previously disabled, enabling | 118 // touch sequence. Note that, if the timeout was previously disabled, enabling |
| 115 // it will take effect only for the following touch sequence. | 119 // it will take effect only for the following touch sequence. |
| 116 void SetAckTimeoutEnabled(bool enabled); | 120 void SetAckTimeoutEnabled(bool enabled); |
| 117 | 121 |
| 118 bool IsAckTimeoutEnabled() const; | 122 bool IsAckTimeoutEnabled() const; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 132 private: | 136 private: |
| 133 class TouchTimeoutHandler; | 137 class TouchTimeoutHandler; |
| 134 class TouchMoveSlopSuppressor; | 138 class TouchMoveSlopSuppressor; |
| 135 friend class TouchTimeoutHandler; | 139 friend class TouchTimeoutHandler; |
| 136 friend class TouchEventQueueTest; | 140 friend class TouchEventQueueTest; |
| 137 | 141 |
| 138 bool HasPendingAsyncTouchMoveForTesting() const; | 142 bool HasPendingAsyncTouchMoveForTesting() const; |
| 139 bool IsTimeoutRunningForTesting() const; | 143 bool IsTimeoutRunningForTesting() const; |
| 140 const TouchEventWithLatencyInfo& GetLatestEventForTesting() const; | 144 const TouchEventWithLatencyInfo& GetLatestEventForTesting() const; |
| 141 | 145 |
| 142 // Empties the queue of touch events. This may result in any number of gesture | |
| 143 // events being sent to the renderer. | |
| 144 void FlushQueue(); | |
| 145 | |
| 146 // Walks the queue, checking each event with |FilterBeforeForwarding()|. | 146 // Walks the queue, checking each event with |FilterBeforeForwarding()|. |
| 147 // If allowed, forwards the touch event and stops processing further events. | 147 // If allowed, forwards the touch event and stops processing further events. |
| 148 // Otherwise, acks the event with |INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS|. | 148 // Otherwise, acks the event with |INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS|. |
| 149 void TryForwardNextEventToRenderer(); | 149 void TryForwardNextEventToRenderer(); |
| 150 | 150 |
| 151 // Forwards the event at the head of the queue to the renderer. | 151 // Forwards the event at the head of the queue to the renderer. |
| 152 void ForwardNextEventToRenderer(); | 152 void ForwardNextEventToRenderer(); |
| 153 | 153 |
| 154 // Pops the touch-event from the head of the queue and acks it to the client. | 154 // Pops the touch-event from the head of the queue and acks it to the client. |
| 155 void PopTouchEventToClient(InputEventAckState ack_result); | 155 void PopTouchEventToClient(InputEventAckState ack_result); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // setting for experimentation, but we may evolve it into an app-controlled | 240 // setting for experimentation, but we may evolve it into an app-controlled |
| 241 // mode. | 241 // mode. |
| 242 const TouchScrollingMode touch_scrolling_mode_; | 242 const TouchScrollingMode touch_scrolling_mode_; |
| 243 | 243 |
| 244 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); | 244 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 } // namespace content | 247 } // namespace content |
| 248 | 248 |
| 249 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 249 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
| OLD | NEW |