Index: content/browser/renderer_host/input/touch_to_gesture_queue.h |
diff --git a/content/browser/renderer_host/input/touch_to_gesture_queue.h b/content/browser/renderer_host/input/touch_to_gesture_queue.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a762fd3f43c488d189e487c46fec2d2361fc96b3 |
--- /dev/null |
+++ b/content/browser/renderer_host/input/touch_to_gesture_queue.h |
@@ -0,0 +1,77 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_TO_GESTURE_QUEUE_H_ |
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_TO_GESTURE_QUEUE_H_ |
+ |
+#include <deque> |
+ |
+#include "content/common/content_export.h" |
+#include "content/port/common/input_event_ack_state.h" |
+#include "third_party/WebKit/public/web/WebInputEvent.h" |
+ |
+namespace content { |
+ |
+class TouchToGestureQueueClient { |
+ public: |
+ virtual ~TouchToGestureQueueClient() {} |
+ virtual void ForwardTouchEvent(const blink::WebTouchEvent&) = 0; |
tdresser
2014/01/14 16:25:30
I think it may be cleaner to do the touch event di
jdduke (slow)
2014/01/14 23:24:03
The main reason I did it this way was because of t
tdresser
2014/01/15 13:43:08
I was under the impression that this solution woul
jdduke (slow)
2014/01/15 20:36:36
In it's current form, that's very much correct. W
|
+ virtual void ForwardGestureEvent(const blink::WebGestureEvent&) = 0; |
+}; |
+ |
+class CONTENT_EXPORT TouchToGestureQueue { |
tdresser
2014/01/14 16:25:30
The names TouchToGesture, TouchToGestureSequence,
jdduke (slow)
2014/01/14 23:24:03
Let's just call it GestureEventQueue? To match Tou
tdresser
2014/01/15 13:43:08
I like that name. I do think that TouchToGesture -
|
+ public: |
+ explicit TouchToGestureQueue(TouchToGestureQueueClient* client); |
+ ~TouchToGestureQueue(); |
+ |
+ // TODO(jdduke): Refactor to take a touch event with a vector of gestures. |
tdresser
2014/01/14 16:25:30
Is it reasonable to perform this refactor before t
jdduke (slow)
2014/01/14 23:24:03
We could. With the way gestures are piped here (v
tdresser
2014/01/15 13:43:08
Aggregating the gestures in CVCI sounds like a goo
|
+ void OnTouchEventHandlingBegin(const blink::WebTouchEvent& event); |
+ void OnGestureEvent(const blink::WebGestureEvent& event); |
+ void OnTouchEventHandlingEnd(); |
+ |
+ void OnTouchEventAck(InputEventAckState ack_state); |
+ |
+ private: |
+ typedef std::deque<blink::WebGestureEvent> Gestures; |
+ |
+ struct TouchToGesture { |
jdduke (slow)
2014/01/13 23:58:56
These data structures aren't very optimized. I'll
|
+ blink::WebTouchEvent touch; |
+ Gestures gestures; |
+ }; |
+ |
+ class TouchToGestureSequence { |
+ public: |
+ TouchToGestureSequence(); |
+ ~TouchToGestureSequence(); |
+ |
+ void Push(const blink::WebTouchEvent& event); |
+ void Push(const blink::WebGestureEvent& event); |
+ TouchToGesture OnTouchEventAck(InputEventAckState ack_state); |
+ bool IsGestureAllowed() const; |
+ bool IsEmpty() const; |
+ const blink::WebTouchEvent& LastTouch() const; |
+ |
+ private: |
+ std::deque<TouchToGesture> sequence; |
+ InputEventAckState ack_state; |
+ }; |
+ |
+ void ForwardGestureEvent(const blink::WebGestureEvent& gesture); |
+ void CancelTapIfNecessary(); |
+ void CancelFlingIfNecessary(); |
+ TouchToGestureSequence& Head(); |
+ TouchToGestureSequence& Tail(); |
+ |
+ TouchToGestureQueueClient* client_; |
+ std::deque<TouchToGestureSequence> sequences_; |
+ bool handling_touch_event_; |
+ bool outstanding_tap_; |
+ bool outstanding_fling_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TouchToGestureQueue); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_TO_GESTURE_QUEUE_H_ |