Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: content/browser/renderer_host/input/gesture_event_packet.h

Issue 181833003: [Android] Out with the Android GR, in with the new unified C++ GR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 ui {
12 class MotionEvent;
13 }
14
11 namespace content { 15 namespace content {
12 16
13 // Acts as a transport container for gestures created (directly or indirectly) 17 // Acts as a transport container for gestures created (directly or indirectly)
14 // by a touch event. 18 // by a touch event.
15 class CONTENT_EXPORT GestureEventPacket { 19 class CONTENT_EXPORT GestureEventPacket {
16 public: 20 public:
17 enum GestureSource { 21 enum GestureSource {
18 UNDEFINED = -1, // Used only for a default-constructed packet. 22 UNDEFINED = -1, // Used only for a default-constructed packet.
19 INVALID, // The source of the gesture was invalid. 23 INVALID, // The source of the gesture was invalid.
20 TOUCH_SEQUENCE_BEGIN, // The start of a new gesture sequence. 24 TOUCH_SEQUENCE_BEGIN, // The start of a new gesture sequence.
21 TOUCH_SEQUENCE_END, // The end of gesture sequence. 25 TOUCH_SEQUENCE_END, // The end of gesture sequence.
22 TOUCH_BEGIN, // A touch down occured during a gesture sequence. 26 TOUCH_BEGIN, // A touch down occured during a gesture sequence.
23 TOUCH_MOVE, // A touch move occured during a gesture sequence. 27 TOUCH_MOVE, // A touch move occured during a gesture sequence.
24 TOUCH_END, // A touch up occured during a gesture sequence. 28 TOUCH_END, // A touch up occured during a gesture sequence.
25 TOUCH_TIMEOUT, // Timeout from an existing gesture sequence. 29 TOUCH_TIMEOUT, // Timeout from an existing gesture sequence.
26 }; 30 };
27 31
28 GestureEventPacket(); 32 GestureEventPacket();
29 GestureEventPacket(const GestureEventPacket& other); 33 GestureEventPacket(const GestureEventPacket& other);
30 ~GestureEventPacket(); 34 ~GestureEventPacket();
31 GestureEventPacket& operator=(const GestureEventPacket& other); 35 GestureEventPacket& operator=(const GestureEventPacket& other);
32 36
33 // Factory methods for creating a packet from a particular event. 37 // Factory methods for creating a packet from a particular event.
34 static GestureEventPacket FromTouch(const blink::WebTouchEvent& event); 38 static GestureEventPacket FromTouch(const ui::MotionEvent& event);
35 static GestureEventPacket FromTouchTimeout( 39 static GestureEventPacket FromTouchTimeout(
36 const blink::WebGestureEvent& event); 40 const blink::WebGestureEvent& event);
37 41
38 void Push(const blink::WebGestureEvent& gesture); 42 void Push(const blink::WebGestureEvent& gesture);
39 43
40 const blink::WebGestureEvent& gesture(size_t i) const { return gestures_[i]; } 44 const blink::WebGestureEvent& gesture(size_t i) const { return gestures_[i]; }
41 size_t gesture_count() const { return gesture_count_; } 45 size_t gesture_count() const { return gesture_count_; }
42 GestureSource gesture_source() const { return gesture_source_; } 46 GestureSource gesture_source() const { return gesture_source_; }
43 47
44 private: 48 private:
45 explicit GestureEventPacket(GestureSource source); 49 explicit GestureEventPacket(GestureSource source);
46 50
47 enum { kMaxGesturesPerTouch = 5 }; 51 enum { kMaxGesturesPerTouch = 5 };
48 blink::WebGestureEvent gestures_[kMaxGesturesPerTouch]; 52 blink::WebGestureEvent gestures_[kMaxGesturesPerTouch];
49 size_t gesture_count_; 53 size_t gesture_count_;
50 GestureSource gesture_source_; 54 GestureSource gesture_source_;
51 }; 55 };
52 56
53 } // namespace content 57 } // namespace content
54 58
55 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_ 59 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_EVENT_PACKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698