| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 // Empties the queue of touch events. This may result in any number of gesture | 55 // Empties the queue of touch events. This may result in any number of gesture |
| 56 // events being sent to the renderer. | 56 // events being sent to the renderer. |
| 57 void FlushQueue(); | 57 void FlushQueue(); |
| 58 | 58 |
| 59 // Returns whether the event-queue is empty. | 59 // Returns whether the event-queue is empty. |
| 60 bool empty() const WARN_UNUSED_RESULT { | 60 bool empty() const WARN_UNUSED_RESULT { |
| 61 return touch_queue_.empty(); | 61 return touch_queue_.empty(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void set_no_touch_move_to_renderer(bool value) { |
| 65 no_touch_move_to_renderer_ = value; |
| 66 } |
| 67 |
| 64 private: | 68 private: |
| 65 friend class MockRenderWidgetHost; | 69 friend class MockRenderWidgetHost; |
| 66 friend class ImmediateInputRouterTest; | 70 friend class ImmediateInputRouterTest; |
| 67 | 71 |
| 68 CONTENT_EXPORT size_t GetQueueSize() const; | 72 CONTENT_EXPORT size_t GetQueueSize() const; |
| 69 CONTENT_EXPORT const TouchEventWithLatencyInfo& GetLatestEvent() const; | 73 CONTENT_EXPORT const TouchEventWithLatencyInfo& GetLatestEvent() const; |
| 70 | 74 |
| 71 // Pops the touch-event from the top of the queue and sends it to the | 75 // Pops the touch-event from the top of the queue and sends it to the |
| 72 // TouchEventQueueClient. This reduces the size of the queue by one. | 76 // TouchEventQueueClient. This reduces the size of the queue by one. |
| 73 void PopTouchEventToClient(InputEventAckState ack_result, | 77 void PopTouchEventToClient(InputEventAckState ack_result, |
| 74 const ui::LatencyInfo& renderer_latency_info); | 78 const ui::LatencyInfo& renderer_latency_info); |
| 75 | 79 |
| 76 bool ShouldForwardToRenderer(const WebKit::WebTouchEvent& event) const; | 80 bool ShouldForwardToRenderer(const WebKit::WebTouchEvent& event) const; |
| 77 | 81 |
| 78 // Handles touch event forwarding and ack'ed event dispatch. | 82 // Handles touch event forwarding and ack'ed event dispatch. |
| 79 TouchEventQueueClient* client_; | 83 TouchEventQueueClient* client_; |
| 80 | 84 |
| 81 typedef std::deque<CoalescedWebTouchEvent*> TouchQueue; | 85 typedef std::deque<CoalescedWebTouchEvent*> TouchQueue; |
| 82 TouchQueue touch_queue_; | 86 TouchQueue touch_queue_; |
| 83 | 87 |
| 84 // Maintain the ACK status for each touch point. | 88 // Maintain the ACK status for each touch point. |
| 85 typedef std::map<int, InputEventAckState> TouchPointAckStates; | 89 typedef std::map<int, InputEventAckState> TouchPointAckStates; |
| 86 TouchPointAckStates touch_ack_states_; | 90 TouchPointAckStates touch_ack_states_; |
| 87 | 91 |
| 88 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|. | 92 // Used to defer touch forwarding when ack dispatch triggers |QueueEvent()|. |
| 89 bool dispatching_touch_ack_; | 93 bool dispatching_touch_ack_; |
| 90 | 94 |
| 95 // Don't send touch move events to renderer. This is enabled when the page |
| 96 // is scrolling. This behaviour is currently enabled only on aura behind a |
| 97 // flag. |
| 98 bool no_touch_move_to_renderer_; |
| 99 |
| 91 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); | 100 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); |
| 92 }; | 101 }; |
| 93 | 102 |
| 94 } // namespace content | 103 } // namespace content |
| 95 | 104 |
| 96 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ | 105 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_ |
| OLD | NEW |