OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_TOUCH_UMA_HISTOGRAM_H_ | |
6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_TOUCH_UMA_HISTOGRAM_H_ | |
7 | |
8 #include "base/time/time.h" | |
9 #include "ui/events/event.h" | |
10 #include "ui/events/gesture_detection/gesture_detection_export.h" | |
11 #include "ui/events/gesture_detection/gesture_event_data.h" | |
12 #include "ui/events/gesture_detection/motion_event.h" | |
13 | |
14 namespace ui { | |
15 | |
16 enum UMAEventType { | |
17 // WARNING: Do not change the numerical values of any of these types. | |
18 // Do not remove deprecated types - just comment them as deprecated. | |
19 UMA_ET_UNKNOWN = 0, | |
20 UMA_ET_TOUCH_RELEASED = 1, | |
21 UMA_ET_TOUCH_PRESSED = 2, | |
22 UMA_ET_TOUCH_MOVED = 3, | |
23 UMA_ET_TOUCH_STATIONARY = 4, // Deprecated. Do not remove. | |
24 UMA_ET_TOUCH_CANCELLED = 5, | |
25 UMA_ET_GESTURE_SCROLL_BEGIN = 6, | |
26 UMA_ET_GESTURE_SCROLL_END = 7, | |
27 UMA_ET_GESTURE_SCROLL_UPDATE = 8, | |
28 UMA_ET_GESTURE_TAP = 9, | |
29 UMA_ET_GESTURE_TAP_DOWN = 10, | |
30 UMA_ET_GESTURE_BEGIN = 11, | |
31 UMA_ET_GESTURE_END = 12, | |
32 UMA_ET_GESTURE_DOUBLE_TAP = 13, | |
33 UMA_ET_GESTURE_TRIPLE_TAP = 14, | |
34 UMA_ET_GESTURE_TWO_FINGER_TAP = 15, | |
35 UMA_ET_GESTURE_PINCH_BEGIN = 16, | |
36 UMA_ET_GESTURE_PINCH_END = 17, | |
37 UMA_ET_GESTURE_PINCH_UPDATE = 18, | |
38 UMA_ET_GESTURE_LONG_PRESS = 19, | |
39 UMA_ET_GESTURE_SWIPE_2 = 20, // Swipe with 2 fingers | |
40 UMA_ET_SCROLL = 21, | |
41 UMA_ET_SCROLL_FLING_START = 22, | |
42 UMA_ET_SCROLL_FLING_CANCEL = 23, | |
43 UMA_ET_GESTURE_SWIPE_3 = 24, // Swipe with 3 fingers | |
44 UMA_ET_GESTURE_SWIPE_4P = 25, // Swipe with 4+ fingers | |
45 UMA_ET_GESTURE_SCROLL_UPDATE_2 = 26, | |
46 UMA_ET_GESTURE_SCROLL_UPDATE_3 = 27, | |
47 UMA_ET_GESTURE_SCROLL_UPDATE_4P = 28, | |
48 UMA_ET_GESTURE_PINCH_UPDATE_3 = 29, | |
49 UMA_ET_GESTURE_PINCH_UPDATE_4P = 30, | |
50 UMA_ET_GESTURE_LONG_TAP = 31, | |
51 UMA_ET_GESTURE_SHOW_PRESS = 32, | |
52 UMA_ET_GESTURE_TAP_CANCEL = 33, | |
53 UMA_ET_GESTURE_WIN8_EDGE_SWIPE = 34, | |
54 UMA_ET_GESTURE_SWIPE_1 = 35, // Swipe with 1 finger | |
55 // NOTE: Add new event types only immediately above this line. Make sure to | |
56 // update the UIEventType enum in tools/metrics/histograms/histograms.xml | |
57 // accordingly. | |
tdresser
2014/08/27 12:35:39
Obey the comment! (Move tap unconfirmed above the
lanwei
2014/08/27 23:32:00
Done.
| |
58 UMA_ET_GESTURE_TAP_UNCONFIRMED = 36, | |
59 UMA_ET_COUNT | |
60 }; | |
61 | |
62 // Records some touch/gesture event specific details (e.g. what gestures are | |
63 // targetted to which components etc.) | |
64 class GESTURE_DETECTION_EXPORT GestureTouchUMAHistogram { | |
65 public: | |
66 GestureTouchUMAHistogram(); | |
67 ~GestureTouchUMAHistogram(); | |
68 | |
69 void RecordGestureEvent(const ui::GestureEventData& gesture); | |
70 void RecordTouchEvent(const ui::MotionEvent& event); | |
71 | |
72 private: | |
73 struct GESTURE_DETECTION_EXPORT WindowTouchDetails { | |
tdresser
2014/08/27 12:35:39
I don't see any reason to put this information in
lanwei
2014/08/27 23:32:00
Done.
| |
74 WindowTouchDetails(); | |
75 WindowTouchDetails(const base::TimeTicks& start_time, | |
76 const gfx::Point& start_touch_position); | |
77 ~WindowTouchDetails(); | |
78 | |
79 // The first finger's press time | |
80 base::TimeTicks start_time_; | |
81 // The first finger's press location | |
82 gfx::Point start_touch_position_; | |
83 // The maximum distance the first touch point travelled from its starting | |
84 // location in pixels. | |
85 float max_distance_from_start_squared_; | |
86 bool is_single_finger_; | |
87 }; | |
88 scoped_ptr<WindowTouchDetails> details; | |
89 EventType TouchEventTypeFromMotionEvent(const MotionEvent& event); | |
90 UMAEventType UMAEventTypeFromEvent(const GestureEventData& gesture); | |
91 }; | |
92 | |
93 } // namespace ui | |
94 | |
95 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_TOUCH_UMA_HISTOGRAM_H_ | |
OLD | NEW |