| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 TouchEventQueue(TouchEventQueueClient* client, const Config& config); | 63 TouchEventQueue(TouchEventQueueClient* client, const Config& config); |
| 64 | 64 |
| 65 ~TouchEventQueue(); | 65 ~TouchEventQueue(); |
| 66 | 66 |
| 67 // Adds an event to the queue. The event may be coalesced with previously | 67 // Adds an event to the queue. The event may be coalesced with previously |
| 68 // queued events (e.g. consecutive touch-move events can be coalesced into a | 68 // queued events (e.g. consecutive touch-move events can be coalesced into a |
| 69 // single touch-move event). The event may also be immediately forwarded to | 69 // single touch-move event). The event may also be immediately forwarded to |
| 70 // the renderer (e.g. when there are no other queued touch event). | 70 // the renderer (e.g. when there are no other queued touch event). |
| 71 void QueueEvent(const TouchEventWithLatencyInfo& event); | 71 void QueueEvent(const TouchEventWithLatencyInfo& event); |
| 72 | 72 |
| 73 // Adds a TouchScrollStarted event to the front of the queue. |
| 74 void PrependTouchScrollNotification(); |
| 75 |
| 73 // Notifies the queue that a touch-event has been processed by the renderer. | 76 // Notifies the queue that a touch-event has been processed by the renderer. |
| 74 // At this point, if the ack is for async touchmove, remove the uncancelable | 77 // At this point, if the ack is for async touchmove, remove the uncancelable |
| 75 // touchmove from the front of the queue and decide if it should dispatch the | 78 // touchmove from the front of the queue and decide if it should dispatch the |
| 76 // next pending async touch move event, otherwise the queue may send one or | 79 // next pending async touch move event, otherwise the queue may send one or |
| 77 // more gesture events and/or additional queued touch-events to the renderer. | 80 // more gesture events and/or additional queued touch-events to the renderer. |
| 78 void ProcessTouchAck(InputEventAckState ack_result, | 81 void ProcessTouchAck(InputEventAckState ack_result, |
| 79 const ui::LatencyInfo& latency_info, | 82 const ui::LatencyInfo& latency_info, |
| 80 const uint32_t unique_touch_event_id); | 83 const uint32_t unique_touch_event_id); |
| 81 | 84 |
| 82 // When GestureScrollBegin is received, we send a touch cancel to renderer, | 85 // When GestureScrollBegin is received, we send a touch cancel to renderer, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 102 void SetAckTimeoutEnabled(bool enabled); | 105 void SetAckTimeoutEnabled(bool enabled); |
| 103 | 106 |
| 104 // Sets whether the current site has a mobile friendly viewport. This | 107 // Sets whether the current site has a mobile friendly viewport. This |
| 105 // determines which ack timeout delay will be used for *future* touch events. | 108 // determines which ack timeout delay will be used for *future* touch events. |
| 106 // The default assumption is that the site is *not* mobile-optimized. | 109 // The default assumption is that the site is *not* mobile-optimized. |
| 107 void SetIsMobileOptimizedSite(bool mobile_optimized_site); | 110 void SetIsMobileOptimizedSite(bool mobile_optimized_site); |
| 108 | 111 |
| 109 // Whether ack timeout behavior is supported and enabled for the current site. | 112 // Whether ack timeout behavior is supported and enabled for the current site. |
| 110 bool IsAckTimeoutEnabled() const; | 113 bool IsAckTimeoutEnabled() const; |
| 111 | 114 |
| 112 bool IsForwardingTouches(); | |
| 113 | |
| 114 bool empty() const WARN_UNUSED_RESULT { | 115 bool empty() const WARN_UNUSED_RESULT { |
| 115 return touch_queue_.empty(); | 116 return touch_queue_.empty(); |
| 116 } | 117 } |
| 117 | 118 |
| 118 size_t size() const { | 119 size_t size() const { |
| 119 return touch_queue_.size(); | 120 return touch_queue_.size(); |
| 120 } | 121 } |
| 121 | 122 |
| 122 bool has_handlers() const { return has_handlers_; } | 123 bool has_handlers() const { return has_handlers_; } |
| 123 | 124 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 243 |
| 243 // Event is saved to compare pointer positions for new touchmove events. | 244 // Event is saved to compare pointer positions for new touchmove events. |
| 244 scoped_ptr<blink::WebTouchEvent> last_sent_touchevent_; | 245 scoped_ptr<blink::WebTouchEvent> last_sent_touchevent_; |
| 245 | 246 |
| 246 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); | 247 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); |
| 247 }; | 248 }; |
| 248 | 249 |
| 249 } // namespace content | 250 } // namespace content |
| 250 | 251 |
| 251 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 252 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
| OLD | NEW |