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.
5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_TOUCH_UMA_HISTOGRAM_H_
6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_TOUCH_UMA_HISTOGRAM_H_
8 #include "base/time/time.h"
9 #include "ui/events/gesture_detection/gesture_detection_export.h"
10 #include "ui/events/gesture_detection/gesture_event_data.h"
11 #include "ui/events/gesture_detection/motion_event.h"
16 // WARNING: Do not change the numerical values of any of these types.
17 // Do not remove deprecated types - just comment them as deprecated.
19 UMA_ET_TOUCH_RELEASED
= 1,
20 UMA_ET_TOUCH_PRESSED
= 2,
21 UMA_ET_TOUCH_MOVED
= 3,
22 UMA_ET_TOUCH_STATIONARY
= 4, // Deprecated. Do not remove.
23 UMA_ET_TOUCH_CANCELLED
= 5,
24 UMA_ET_GESTURE_SCROLL_BEGIN
= 6,
25 UMA_ET_GESTURE_SCROLL_END
= 7,
26 UMA_ET_GESTURE_SCROLL_UPDATE
= 8,
27 UMA_ET_GESTURE_TAP
= 9,
28 UMA_ET_GESTURE_TAP_DOWN
= 10,
29 UMA_ET_GESTURE_BEGIN
= 11,
30 UMA_ET_GESTURE_END
= 12,
31 UMA_ET_GESTURE_DOUBLE_TAP
= 13,
32 UMA_ET_GESTURE_TRIPLE_TAP
= 14,
33 UMA_ET_GESTURE_TWO_FINGER_TAP
= 15,
34 UMA_ET_GESTURE_PINCH_BEGIN
= 16,
35 UMA_ET_GESTURE_PINCH_END
= 17,
36 UMA_ET_GESTURE_PINCH_UPDATE
= 18,
37 UMA_ET_GESTURE_LONG_PRESS
= 19,
38 UMA_ET_GESTURE_SWIPE_2
= 20, // Swipe with 2 fingers
40 UMA_ET_SCROLL_FLING_START
= 22,
41 UMA_ET_SCROLL_FLING_CANCEL
= 23,
42 UMA_ET_GESTURE_SWIPE_3
= 24, // Swipe with 3 fingers
43 UMA_ET_GESTURE_SWIPE_4P
= 25, // Swipe with 4+ fingers
44 UMA_ET_GESTURE_SCROLL_UPDATE_2
= 26,
45 UMA_ET_GESTURE_SCROLL_UPDATE_3
= 27,
46 UMA_ET_GESTURE_SCROLL_UPDATE_4P
= 28,
47 UMA_ET_GESTURE_PINCH_UPDATE_3
= 29,
48 UMA_ET_GESTURE_PINCH_UPDATE_4P
= 30,
49 UMA_ET_GESTURE_LONG_TAP
= 31,
50 UMA_ET_GESTURE_SHOW_PRESS
= 32,
51 UMA_ET_GESTURE_TAP_CANCEL
= 33,
52 UMA_ET_GESTURE_WIN8_EDGE_SWIPE
= 34,
53 UMA_ET_GESTURE_SWIPE_1
= 35, // Swipe with 1 finger
54 UMA_ET_GESTURE_TAP_UNCONFIRMED
= 36,
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
61 // Records some touch/gesture event specific details (e.g. what gestures are
62 // targetted to which components etc.)
63 class GESTURE_DETECTION_EXPORT GestureTouchUMAHistogram
{
65 GestureTouchUMAHistogram();
66 ~GestureTouchUMAHistogram();
68 static void RecordGestureEvent(const ui::GestureEventData
& gesture
);
69 void RecordTouchEvent(const ui::MotionEvent
& event
);
72 static UMAEventType
UMAEventTypeFromEvent(const GestureEventData
& gesture
);
74 // The first finger's press time.
75 base::TimeTicks start_time_
;
76 // The first finger's press location.
77 gfx::Point start_touch_position_
;
78 // The maximum distance the first touch point travelled from its starting
79 // location in pixels.
80 float max_distance_from_start_squared_
;
81 bool is_single_finger_
;
86 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_TOUCH_UMA_HISTOGRAM_H_