OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_TOUCH_EVENT_QUEUE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_TOUCH_EVENT_QUEUE_H_ |
| 7 |
| 8 #include <deque> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 class RenderWidgetHostImpl; |
| 16 |
| 17 // A queue for throttling and coalescing touch-events. |
| 18 class TouchEventQueue { |
| 19 public: |
| 20 explicit TouchEventQueue(RenderWidgetHostImpl* host); |
| 21 virtual ~TouchEventQueue(); |
| 22 |
| 23 // Adds an event to the queue. The event may be coalesced with previously |
| 24 // queued events (e.g. consecutive touch-move events can be coalesced into a |
| 25 // single touch-move event). The event may also be immediately forwarded to |
| 26 // the renderer (e.g. when there are no other queued touch event). |
| 27 void QueueEvent(const WebKit::WebTouchEvent& event); |
| 28 |
| 29 // Notifies the queue that a touch-event has been processed by the renderer. |
| 30 // At this point, the queue may send one or more gesture events and/or |
| 31 // additional queued touch-events to the renderer. |
| 32 void ProcessTouchAck(bool processed); |
| 33 |
| 34 private: |
| 35 // The RenderWidgetHost that owns this event-queue. |
| 36 RenderWidgetHostImpl* render_widget_host_; |
| 37 |
| 38 typedef std::deque<WebKit::WebTouchEvent> TouchQueue; |
| 39 TouchQueue touch_queue_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(TouchEventQueue); |
| 42 }; |
| 43 |
| 44 } // namespace content |
| 45 |
| 46 #endif // CONTENT_BROWSER_RENDERER_HOST_TOUCH_EVENT_QUEUE_H_ |
OLD | NEW |