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