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 UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DATA_PACKET_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DATA_PACKET_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "ui/events/gesture_detection/gesture_detection_export.h" |
9 #include "third_party/WebKit/public/web/WebInputEvent.h" | 9 #include "ui/events/gesture_detection/gesture_event_data.h" |
10 | 10 |
11 namespace content { | 11 namespace ui { |
| 12 |
| 13 class MotionEvent; |
12 | 14 |
13 // Acts as a transport container for gestures created (directly or indirectly) | 15 // Acts as a transport container for gestures created (directly or indirectly) |
14 // by a touch event. | 16 // by a touch event. |
15 class CONTENT_EXPORT GestureEventPacket { | 17 class GESTURE_DETECTION_EXPORT GestureEventDataPacket { |
16 public: | 18 public: |
17 enum GestureSource { | 19 enum GestureSource { |
18 UNDEFINED = -1, // Used only for a default-constructed packet. | 20 UNDEFINED = -1, // Used only for a default-constructed packet. |
19 INVALID, // The source of the gesture was invalid. | 21 INVALID, // The source of the gesture was invalid. |
20 TOUCH_SEQUENCE_START, // The start of a new gesture sequence. | 22 TOUCH_SEQUENCE_START, // The start of a new gesture sequence. |
21 TOUCH_SEQUENCE_END, // The end of gesture sequence. | 23 TOUCH_SEQUENCE_END, // The end of gesture sequence. |
22 TOUCH_START, // A touch down occured during a gesture sequence. | 24 TOUCH_START, // A touch down occured during a gesture sequence. |
23 TOUCH_MOVE, // A touch move occured during a gesture sequence. | 25 TOUCH_MOVE, // A touch move occured during a gesture sequence. |
24 TOUCH_END, // A touch up occured during a gesture sequence. | 26 TOUCH_END, // A touch up occured during a gesture sequence. |
25 TOUCH_TIMEOUT, // Timeout from an existing gesture sequence. | 27 TOUCH_TIMEOUT, // Timeout from an existing gesture sequence. |
26 }; | 28 }; |
27 | 29 |
28 GestureEventPacket(); | 30 GestureEventDataPacket(); |
29 GestureEventPacket(const GestureEventPacket& other); | 31 GestureEventDataPacket(const GestureEventDataPacket& other); |
30 ~GestureEventPacket(); | 32 ~GestureEventDataPacket(); |
31 GestureEventPacket& operator=(const GestureEventPacket& other); | 33 GestureEventDataPacket& operator=(const GestureEventDataPacket& other); |
32 | 34 |
33 // Factory methods for creating a packet from a particular event. | 35 // Factory methods for creating a packet from a particular event. |
34 static GestureEventPacket FromTouch(const blink::WebTouchEvent& event); | 36 static GestureEventDataPacket FromTouch(const ui::MotionEvent& touch); |
35 static GestureEventPacket FromTouchTimeout( | 37 static GestureEventDataPacket FromTouchTimeout( |
36 const blink::WebGestureEvent& event); | 38 const GestureEventData& gesture); |
37 | 39 |
38 void Push(const blink::WebGestureEvent& gesture); | 40 void Push(const GestureEventData& gesture); |
39 | 41 |
40 const blink::WebGestureEvent& gesture(size_t i) const { return gestures_[i]; } | 42 const GestureEventData& gesture(size_t i) const { return gestures_[i]; } |
41 size_t gesture_count() const { return gesture_count_; } | 43 size_t gesture_count() const { return gesture_count_; } |
42 GestureSource gesture_source() const { return gesture_source_; } | 44 GestureSource gesture_source() const { return gesture_source_; } |
43 | 45 |
44 private: | 46 private: |
45 explicit GestureEventPacket(GestureSource source); | 47 explicit GestureEventDataPacket(GestureSource source); |
46 | 48 |
47 enum { kMaxGesturesPerTouch = 5 }; | 49 enum { kMaxGesturesPerTouch = 5 }; |
48 blink::WebGestureEvent gestures_[kMaxGesturesPerTouch]; | 50 GestureEventData gestures_[kMaxGesturesPerTouch]; |
49 size_t gesture_count_; | 51 size_t gesture_count_; |
50 GestureSource gesture_source_; | 52 GestureSource gesture_source_; |
51 }; | 53 }; |
52 | 54 |
53 } // namespace content | 55 } // namespace ui |
54 | 56 |
55 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_ | 57 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DATA_PACKET_H_ |
OLD | NEW |