| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 virtual void OnTouchEventAck( | 32 virtual void OnTouchEventAck( |
| 33 const TouchEventWithLatencyInfo& event, | 33 const TouchEventWithLatencyInfo& event, |
| 34 InputEventAckState ack_result) = 0; | 34 InputEventAckState ack_result) = 0; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 // A queue for throttling and coalescing touch-events. | 37 // A queue for throttling and coalescing touch-events. |
| 38 class CONTENT_EXPORT TouchEventQueue { | 38 class CONTENT_EXPORT TouchEventQueue { |
| 39 public: | 39 public: |
| 40 // Different ways of dealing with touch events during scrolling. | 40 // Different ways of dealing with touch events during scrolling. |
| 41 // TODO(rbyers): Remove (or otherwise update) this once results of | 41 // TODO(rbyers): Remove this once we're confident that touch move absorption |
| 42 // experiments are complete. http://crbug.com/328503 | 42 // is OK. http://crbug.com/350430 |
| 43 enum TouchScrollingMode { | 43 enum TouchScrollingMode { |
| 44 // Send a touchcancel on scroll start and no further touch events for the | 44 // Send a touchcancel on scroll start and no further touch events for the |
| 45 // duration of the scroll. Chrome Android's traditional behavior. | 45 // duration of the scroll. Chrome Android's traditional behavior. |
| 46 TOUCH_SCROLLING_MODE_TOUCHCANCEL, | 46 TOUCH_SCROLLING_MODE_TOUCHCANCEL, |
| 47 // Send touchmove events throughout a scroll, blocking on each ACK and | 47 // Send touchmove events throughout a scroll, blocking on each ACK and |
| 48 // using the disposition to determine whether a scroll update should be | 48 // using the disposition to determine whether a scroll update should be |
| 49 // sent. Mobile Safari's default overflow scroll behavior. | 49 // sent. Mobile Safari's default overflow scroll behavior. |
| 50 TOUCH_SCROLLING_MODE_SYNC_TOUCHMOVE, | 50 TOUCH_SCROLLING_MODE_SYNC_TOUCHMOVE, |
| 51 // Like sync, except that consumed scroll events cause subsequent touchmove | 51 // Like sync, except that consumed scroll events cause subsequent touchmove |
| 52 // events to be suppressed. Unconsumed scroll events return touchmove | 52 // events to be suppressed. Unconsumed scroll events return touchmove |
| 53 // events to being dispatched synchronously (so scrolling may be hijacked | 53 // events to being dispatched synchronously (so scrolling may be hijacked |
| 54 // when a scroll limit is reached, and later resumed). | 54 // when a scroll limit is reached, and later resumed). http://goo.gl/RShsdN |
| 55 TOUCH_SCROLLING_MODE_ABSORB_TOUCHMOVE, | 55 TOUCH_SCROLLING_MODE_ABSORB_TOUCHMOVE, |
| 56 TOUCH_SCROLLING_MODE_DEFAULT = TOUCH_SCROLLING_MODE_TOUCHCANCEL | 56 TOUCH_SCROLLING_MODE_DEFAULT = TOUCH_SCROLLING_MODE_ABSORB_TOUCHMOVE |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // The |client| must outlive the TouchEventQueue. If | 59 // The |client| must outlive the TouchEventQueue. If |
| 60 // |touchmove_suppression_length_dips| <= 0, touch move suppression is | 60 // |touchmove_suppression_length_dips| <= 0, touch move suppression is |
| 61 // disabled. | 61 // disabled. |
| 62 TouchEventQueue(TouchEventQueueClient* client, | 62 TouchEventQueue(TouchEventQueueClient* client, |
| 63 TouchScrollingMode mode, | 63 TouchScrollingMode mode, |
| 64 double touchmove_suppression_length_dips); | 64 double touchmove_suppression_length_dips); |
| 65 ~TouchEventQueue(); | 65 ~TouchEventQueue(); |
| 66 | 66 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 // setting for experimentation, but we may evolve it into an app-controlled | 199 // setting for experimentation, but we may evolve it into an app-controlled |
| 200 // mode. | 200 // mode. |
| 201 const TouchScrollingMode touch_scrolling_mode_; | 201 const TouchScrollingMode touch_scrolling_mode_; |
| 202 | 202 |
| 203 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); | 203 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 } // namespace content | 206 } // namespace content |
| 207 | 207 |
| 208 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 208 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
| OLD | NEW |