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

Side by Side Diff: ui/events/gesture_detection/gesture_event_data.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: Fix type count Created 6 years, 9 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 UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_PARAMS_H_ 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DATA_H_
6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_PARAMS_H_ 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DATA_H_
7 7
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "ui/events/gesture_detection/gesture_detection_export.h" 9 #include "ui/events/gesture_detection/gesture_detection_export.h"
10 10
11 namespace ui { 11 namespace ui {
12 12
13 enum GestureEventType { 13 enum GestureEventType {
14 GESTURE_TYPE_INVALID = -1,
15 GESTURE_TYPE_FIRST = 0,
16 GESTURE_TAP_DOWN = GESTURE_TYPE_FIRST,
17 GESTURE_TAP_UNCONFIRMED,
18 GESTURE_TAP,
19 GESTURE_DOUBLE_TAP,
20 GESTURE_TAP_CANCEL,
14 GESTURE_SHOW_PRESS, 21 GESTURE_SHOW_PRESS,
15 GESTURE_DOUBLE_TAP, 22 GESTURE_LONG_TAP,
16 GESTURE_SINGLE_TAP_CONFIRMED,
17 GESTURE_SINGLE_TAP_UNCONFIRMED,
18 GESTURE_LONG_PRESS, 23 GESTURE_LONG_PRESS,
19 GESTURE_SCROLL_BEGIN, 24 GESTURE_SCROLL_BEGIN,
20 GESTURE_SCROLL_UPDATE, 25 GESTURE_SCROLL_UPDATE,
21 GESTURE_SCROLL_END, 26 GESTURE_SCROLL_END,
22 GESTURE_FLING_START, 27 GESTURE_FLING_START,
23 GESTURE_FLING_CANCEL, 28 GESTURE_FLING_CANCEL,
24 GESTURE_PINCH_BEGIN, 29 GESTURE_PINCH_BEGIN,
25 GESTURE_PINCH_UPDATE, 30 GESTURE_PINCH_UPDATE,
26 GESTURE_PINCH_END, 31 GESTURE_PINCH_END,
27 GESTURE_TAP_CANCEL, 32 GESTURE_TYPE_LAST = GESTURE_PINCH_END,
28 GESTURE_LONG_TAP,
29 GESTURE_TAP_DOWN
30 }; 33 };
31 34
32 // TODO(jdduke): Convert all (x,y) and (width,height) pairs to their 35 class GestureEventDataPacket;
33 // corresponding gfx:: geometry types. 36
34 struct GESTURE_DETECTION_EXPORT GestureEventParams { 37 // Simple transport construct for gesture-related event data.
35 struct Data; 38 // TODO(jdduke): Merge this class with ui::GestureEventDetails.
36 GestureEventParams(GestureEventType type, 39 struct GESTURE_DETECTION_EXPORT GestureEventData {
37 base::TimeTicks time, 40 struct Details;
38 float x, 41 GestureEventData(GestureEventType type,
39 float y, 42 base::TimeTicks time,
40 const Data& data); 43 float x,
44 float y,
45 const Details& details);
41 46
42 GestureEventType type; 47 GestureEventType type;
43 base::TimeTicks time; 48 base::TimeTicks time;
44 float x; 49 float x;
45 float y; 50 float y;
46 51
47 // TODO(jdduke): Determine if we can simply re-use blink::WebGestureEvent, as 52 // TODO(jdduke): Determine if we can simply re-use blink::WebGestureEvent, as
48 // this is more or less straight up duplication. 53 // this is more or less straight up duplication.
49 struct Data { 54 struct Details {
50 Data(); 55 Details();
51 union { 56 union {
52 struct { 57 struct {
53 int tap_count; 58 int tap_count;
54 float width; 59 float width;
55 float height; 60 float height;
56 } tap; 61 } tap;
57 62
58 struct { 63 struct {
59 float width; 64 float width;
60 float height; 65 float height;
61 } tap_down; 66 } tap_down;
62 67
63 struct { 68 struct {
64 float width; 69 float width;
65 float height; 70 float height;
66 } show_press; 71 } show_press;
67 72
68 struct { 73 struct {
69 float width; 74 float width;
70 float height; 75 float height;
71 } long_press; 76 } long_press;
72 77
73 struct { 78 struct {
74 // Initial motion that triggered the scroll. 79 // Initial motion that triggered the scroll.
75 // May be redundant with deltaX/deltaY in the first scrollUpdate. 80 // May be redundant with delta_x/delta_y in the first scroll_update.
76 float delta_x_hint; 81 float delta_x_hint;
77 float delta_y_hint; 82 float delta_y_hint;
78 } scroll_begin; 83 } scroll_begin;
79 84
80 struct { 85 struct {
81 float delta_x; 86 float delta_x;
82 float delta_y; 87 float delta_y;
83 float velocity_x; 88 float velocity_x;
84 float velocity_y; 89 float velocity_y;
85 } scroll_update; 90 } scroll_update;
86 91
87 struct { 92 struct {
88 float velocity_x; 93 float velocity_x;
89 float velocity_y; 94 float velocity_y;
90 } fling_start; 95 } fling_start;
91 96
92 struct { 97 struct {
93 float scale; 98 float scale;
94 } pinch_update; 99 } pinch_update;
95 }; 100 };
96 } data; 101 } details;
97 102
98 private: 103 private:
99 GestureEventParams(); 104 friend class GestureEventDataPacket;
105
106 // Initializes type to GESTURE_TYPE_INVALID.
107 GestureEventData();
100 }; 108 };
101 109
102 } // namespace ui 110 } // namespace ui
103 111
104 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_PARAMS_H_ 112 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698