OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_TO_GESTURE_QUEUE_H_ | |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_TO_GESTURE_QUEUE_H_ | |
7 | |
8 #include <deque> | |
9 | |
10 #include "content/common/content_export.h" | |
11 #include "content/port/common/input_event_ack_state.h" | |
12 #include "third_party/WebKit/public/web/WebInputEvent.h" | |
13 | |
14 namespace content { | |
15 | |
16 class TouchToGestureQueueClient { | |
17 public: | |
18 virtual ~TouchToGestureQueueClient() {} | |
19 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
| |
20 virtual void ForwardGestureEvent(const blink::WebGestureEvent&) = 0; | |
21 }; | |
22 | |
23 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 -
| |
24 public: | |
25 explicit TouchToGestureQueue(TouchToGestureQueueClient* client); | |
26 ~TouchToGestureQueue(); | |
27 | |
28 // 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
| |
29 void OnTouchEventHandlingBegin(const blink::WebTouchEvent& event); | |
30 void OnGestureEvent(const blink::WebGestureEvent& event); | |
31 void OnTouchEventHandlingEnd(); | |
32 | |
33 void OnTouchEventAck(InputEventAckState ack_state); | |
34 | |
35 private: | |
36 typedef std::deque<blink::WebGestureEvent> Gestures; | |
37 | |
38 struct TouchToGesture { | |
jdduke (slow)
2014/01/13 23:58:56
These data structures aren't very optimized. I'll
| |
39 blink::WebTouchEvent touch; | |
40 Gestures gestures; | |
41 }; | |
42 | |
43 class TouchToGestureSequence { | |
44 public: | |
45 TouchToGestureSequence(); | |
46 ~TouchToGestureSequence(); | |
47 | |
48 void Push(const blink::WebTouchEvent& event); | |
49 void Push(const blink::WebGestureEvent& event); | |
50 TouchToGesture OnTouchEventAck(InputEventAckState ack_state); | |
51 bool IsGestureAllowed() const; | |
52 bool IsEmpty() const; | |
53 const blink::WebTouchEvent& LastTouch() const; | |
54 | |
55 private: | |
56 std::deque<TouchToGesture> sequence; | |
57 InputEventAckState ack_state; | |
58 }; | |
59 | |
60 void ForwardGestureEvent(const blink::WebGestureEvent& gesture); | |
61 void CancelTapIfNecessary(); | |
62 void CancelFlingIfNecessary(); | |
63 TouchToGestureSequence& Head(); | |
64 TouchToGestureSequence& Tail(); | |
65 | |
66 TouchToGestureQueueClient* client_; | |
67 std::deque<TouchToGestureSequence> sequences_; | |
68 bool handling_touch_event_; | |
69 bool outstanding_tap_; | |
70 bool outstanding_fling_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(TouchToGestureQueue); | |
73 }; | |
74 | |
75 } // namespace content | |
76 | |
77 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_TO_GESTURE_QUEUE_H_ | |
OLD | NEW |