OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GESTURE_EVENT_PACKET_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 #include "third_party/WebKit/public/web/WebInputEvent.h" | 9 #include "third_party/WebKit/public/web/WebInputEvent.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 // Acts as a transport container for gestures created (directly or indirectly) | 13 // Acts as a transport container for gestures created (directly or indirectly) |
14 // by a touch event. | 14 // by a touch event. |
15 class CONTENT_EXPORT GestureEventPacket { | 15 class CONTENT_EXPORT GestureEventPacket { |
16 public: | 16 public: |
17 enum GestureSource { | 17 enum GestureSource { |
18 INVALID = -1, // Used only for a default-constructed packet.. | 18 INVALID = -1, // Used only for a default-constructed packet. |
19 TOUCH_BEGIN, // The start of a new gesture sequence. | 19 TOUCH_SEQUENCE_BEGIN, // The start of a new gesture sequence. |
20 TOUCH, // Continuation of an existing gesture sequence. | 20 TOUCH_BEGIN, // A non-primary pointer was put down. TODO - reword these. |
21 TOUCH_TIMEOUT, // Timeout from an existing gesture sequence. | 21 TOUCH_MOVE, // A touch point moved. |
22 TOUCH_END, // A touch point lifted. | |
jdduke (slow)
2014/02/11 16:02:25
Now that we're adding a few types, do you think it
tdresser
2014/02/11 21:04:32
Done.
| |
23 TOUCH_TIMEOUT, // Timeout from an existing gesture sequence. | |
22 }; | 24 }; |
23 | 25 |
24 GestureEventPacket(); | 26 GestureEventPacket(); |
25 ~GestureEventPacket(); | 27 ~GestureEventPacket(); |
26 | 28 |
27 // Factory methods for creating a packet from a particular event. | 29 // Factory methods for creating a packet from a particular event. |
28 static GestureEventPacket FromTouch(const blink::WebTouchEvent& event); | 30 static GestureEventPacket FromTouch(const blink::WebTouchEvent& event); |
29 static GestureEventPacket FromTouchTimeout( | 31 static GestureEventPacket FromTouchTimeout( |
30 const blink::WebGestureEvent& event); | 32 const blink::WebGestureEvent& event); |
31 | 33 |
32 void Push(const blink::WebGestureEvent& gesture); | 34 void Push(const blink::WebGestureEvent& gesture); |
33 | 35 |
34 const blink::WebGestureEvent& gesture(size_t i) const { return gestures_[i]; } | 36 const blink::WebGestureEvent& gesture(size_t i) const { return gestures_[i]; } |
35 size_t gesture_count() const { return gesture_count_; } | 37 size_t gesture_count() const { return gesture_count_; } |
36 GestureSource gesture_source() const { return gesture_source_; } | 38 GestureSource gesture_source() const { return gesture_source_; } |
37 | 39 |
38 private: | 40 private: |
39 explicit GestureEventPacket(GestureSource source); | 41 explicit GestureEventPacket(GestureSource source); |
40 | 42 |
41 enum { kMaxGesturesPerTouch = 5 }; | 43 enum { kMaxGesturesPerTouch = 5 }; |
42 blink::WebGestureEvent gestures_[kMaxGesturesPerTouch]; | 44 blink::WebGestureEvent gestures_[kMaxGesturesPerTouch]; |
43 size_t gesture_count_; | 45 size_t gesture_count_; |
44 GestureSource gesture_source_; | 46 GestureSource gesture_source_; |
47 bool is_independent_; | |
jdduke (slow)
2014/02/11 16:02:25
Do we still need this flag?
tdresser
2014/02/11 21:04:33
Nope, removed.
| |
45 }; | 48 }; |
46 | 49 |
47 } // namespace content | 50 } // namespace content |
48 | 51 |
49 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_ | 52 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_ |
OLD | NEW |