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

Side by Side Diff: ash/touch/touch_uma.cc

Issue 302463004: Implementing the dispatch of the swipe gesture for one-finger touch swipes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing review feedback and also rebasing to resolve conflicts. Created 6 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ash/touch/touch_uma.h" 5 #include "ash/touch/touch_uma.h"
6 6
7 #include "ash/metrics/user_metrics_recorder.h" 7 #include "ash/metrics/user_metrics_recorder.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 26 matching lines...) Expand all
37 UMA_ET_GESTURE_TAP_DOWN, 37 UMA_ET_GESTURE_TAP_DOWN,
38 UMA_ET_GESTURE_BEGIN, 38 UMA_ET_GESTURE_BEGIN,
39 UMA_ET_GESTURE_END, 39 UMA_ET_GESTURE_END,
40 UMA_ET_GESTURE_DOUBLE_TAP, 40 UMA_ET_GESTURE_DOUBLE_TAP,
41 UMA_ET_GESTURE_TRIPLE_TAP, 41 UMA_ET_GESTURE_TRIPLE_TAP,
42 UMA_ET_GESTURE_TWO_FINGER_TAP, 42 UMA_ET_GESTURE_TWO_FINGER_TAP,
43 UMA_ET_GESTURE_PINCH_BEGIN, 43 UMA_ET_GESTURE_PINCH_BEGIN,
44 UMA_ET_GESTURE_PINCH_END, 44 UMA_ET_GESTURE_PINCH_END,
45 UMA_ET_GESTURE_PINCH_UPDATE, 45 UMA_ET_GESTURE_PINCH_UPDATE,
46 UMA_ET_GESTURE_LONG_PRESS, 46 UMA_ET_GESTURE_LONG_PRESS,
47 UMA_ET_GESTURE_MULTIFINGER_SWIPE, 47 UMA_ET_GESTURE_MULTIFINGER_SWIPE_2,
sky 2014/05/27 17:27:54 Document what this and swipe 1 is.
sky 2014/05/27 17:27:54 Can you move all the UMA_ET_GESTURE_MULTIFINGER_SW
Alexei Svitkine (slow) 2014/05/27 17:29:12 If this is used in UMA enum histograms (which it l
sky 2014/05/27 17:36:33 Bummer. If that is the case we should have that wa
mfomitchev 2014/05/27 18:33:43 Done.
mfomitchev 2014/05/27 18:33:43 Done.
48 UMA_ET_SCROLL, 48 UMA_ET_SCROLL,
49 UMA_ET_SCROLL_FLING_START, 49 UMA_ET_SCROLL_FLING_START,
50 UMA_ET_SCROLL_FLING_CANCEL, 50 UMA_ET_SCROLL_FLING_CANCEL,
51 UMA_ET_GESTURE_MULTIFINGER_SWIPE_3, 51 UMA_ET_GESTURE_MULTIFINGER_SWIPE_3,
52 UMA_ET_GESTURE_MULTIFINGER_SWIPE_4P, // 4+ fingers 52 UMA_ET_GESTURE_MULTIFINGER_SWIPE_4P, // 4+ fingers
53 UMA_ET_GESTURE_SCROLL_UPDATE_2, 53 UMA_ET_GESTURE_SCROLL_UPDATE_2,
54 UMA_ET_GESTURE_SCROLL_UPDATE_3, 54 UMA_ET_GESTURE_SCROLL_UPDATE_3,
55 UMA_ET_GESTURE_SCROLL_UPDATE_4P, 55 UMA_ET_GESTURE_SCROLL_UPDATE_4P,
56 UMA_ET_GESTURE_PINCH_UPDATE_3, 56 UMA_ET_GESTURE_PINCH_UPDATE_3,
57 UMA_ET_GESTURE_PINCH_UPDATE_4P, 57 UMA_ET_GESTURE_PINCH_UPDATE_4P,
58 UMA_ET_GESTURE_LONG_TAP, 58 UMA_ET_GESTURE_LONG_TAP,
59 UMA_ET_GESTURE_SHOW_PRESS, 59 UMA_ET_GESTURE_SHOW_PRESS,
60 UMA_ET_GESTURE_TAP_CANCEL, 60 UMA_ET_GESTURE_TAP_CANCEL,
61 UMA_ET_GESTURE_WIN8_EDGE_SWIPE, 61 UMA_ET_GESTURE_WIN8_EDGE_SWIPE,
62 UMA_ET_GESTURE_MULTIFINGER_SWIPE_1,
62 // NOTE: Add new event types only immediately above this line. Make sure to 63 // NOTE: Add new event types only immediately above this line. Make sure to
63 // update the UIEventType enum in tools/metrics/histograms/histograms.xml 64 // update the UIEventType enum in tools/metrics/histograms/histograms.xml
64 // accordingly. 65 // accordingly.
65 UMA_ET_COUNT 66 UMA_ET_COUNT
66 }; 67 };
67 68
68 struct WindowTouchDetails { 69 struct WindowTouchDetails {
69 WindowTouchDetails() 70 WindowTouchDetails()
70 : max_distance_from_start_squared_(0) { 71 : max_distance_from_start_squared_(0) {
71 } 72 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return UMA_ET_TOUCH_MOVED; 107 return UMA_ET_TOUCH_MOVED;
107 case ui::ET_TOUCH_CANCELLED: 108 case ui::ET_TOUCH_CANCELLED:
108 return UMA_ET_TOUCH_CANCELLED; 109 return UMA_ET_TOUCH_CANCELLED;
109 case ui::ET_GESTURE_SCROLL_BEGIN: 110 case ui::ET_GESTURE_SCROLL_BEGIN:
110 return UMA_ET_GESTURE_SCROLL_BEGIN; 111 return UMA_ET_GESTURE_SCROLL_BEGIN;
111 case ui::ET_GESTURE_SCROLL_END: 112 case ui::ET_GESTURE_SCROLL_END:
112 return UMA_ET_GESTURE_SCROLL_END; 113 return UMA_ET_GESTURE_SCROLL_END;
113 case ui::ET_GESTURE_SCROLL_UPDATE: { 114 case ui::ET_GESTURE_SCROLL_UPDATE: {
114 const ui::GestureEvent& gesture = 115 const ui::GestureEvent& gesture =
115 static_cast<const ui::GestureEvent&>(event); 116 static_cast<const ui::GestureEvent&>(event);
116 if (gesture.details().touch_points() >= 4) 117 if (gesture.details().touch_points() == 1)
117 return UMA_ET_GESTURE_SCROLL_UPDATE_4P; 118 return UMA_ET_GESTURE_SCROLL_UPDATE;
119 else if (gesture.details().touch_points() == 2)
120 return UMA_ET_GESTURE_SCROLL_UPDATE_2;
118 else if (gesture.details().touch_points() == 3) 121 else if (gesture.details().touch_points() == 3)
119 return UMA_ET_GESTURE_SCROLL_UPDATE_3; 122 return UMA_ET_GESTURE_SCROLL_UPDATE_3;
120 else if (gesture.details().touch_points() == 2) 123 return UMA_ET_GESTURE_SCROLL_UPDATE_4P;
tdresser 2014/05/27 12:07:31 Thanks for catching this case - I think this does
121 return UMA_ET_GESTURE_SCROLL_UPDATE_2;
122 return UMA_ET_GESTURE_SCROLL_UPDATE;
123 } 124 }
124 case ui::ET_GESTURE_TAP: { 125 case ui::ET_GESTURE_TAP: {
125 const ui::GestureEvent& gesture = 126 const ui::GestureEvent& gesture =
126 static_cast<const ui::GestureEvent&>(event); 127 static_cast<const ui::GestureEvent&>(event);
127 int tap_count = gesture.details().tap_count(); 128 int tap_count = gesture.details().tap_count();
128 if (tap_count == 1) 129 if (tap_count == 1)
129 return UMA_ET_GESTURE_TAP; 130 return UMA_ET_GESTURE_TAP;
130 if (tap_count == 2) 131 if (tap_count == 2)
131 return UMA_ET_GESTURE_DOUBLE_TAP; 132 return UMA_ET_GESTURE_DOUBLE_TAP;
132 if (tap_count == 3) 133 if (tap_count == 3)
(...skipping 19 matching lines...) Expand all
152 if (gesture.details().touch_points() >= 4) 153 if (gesture.details().touch_points() >= 4)
153 return UMA_ET_GESTURE_PINCH_UPDATE_4P; 154 return UMA_ET_GESTURE_PINCH_UPDATE_4P;
154 else if (gesture.details().touch_points() == 3) 155 else if (gesture.details().touch_points() == 3)
155 return UMA_ET_GESTURE_PINCH_UPDATE_3; 156 return UMA_ET_GESTURE_PINCH_UPDATE_3;
156 return UMA_ET_GESTURE_PINCH_UPDATE; 157 return UMA_ET_GESTURE_PINCH_UPDATE;
157 } 158 }
158 case ui::ET_GESTURE_LONG_PRESS: 159 case ui::ET_GESTURE_LONG_PRESS:
159 return UMA_ET_GESTURE_LONG_PRESS; 160 return UMA_ET_GESTURE_LONG_PRESS;
160 case ui::ET_GESTURE_LONG_TAP: 161 case ui::ET_GESTURE_LONG_TAP:
161 return UMA_ET_GESTURE_LONG_TAP; 162 return UMA_ET_GESTURE_LONG_TAP;
162 case ui::ET_GESTURE_MULTIFINGER_SWIPE: { 163 case ui::ET_GESTURE_SWIPE: {
163 const ui::GestureEvent& gesture = 164 const ui::GestureEvent& gesture =
164 static_cast<const ui::GestureEvent&>(event); 165 static_cast<const ui::GestureEvent&>(event);
165 if (gesture.details().touch_points() >= 4) 166 if (gesture.details().touch_points() == 1)
166 return UMA_ET_GESTURE_MULTIFINGER_SWIPE_4P; 167 return UMA_ET_GESTURE_MULTIFINGER_SWIPE_1;
168 else if (gesture.details().touch_points() == 2)
169 return UMA_ET_GESTURE_MULTIFINGER_SWIPE_2;
167 else if (gesture.details().touch_points() == 3) 170 else if (gesture.details().touch_points() == 3)
168 return UMA_ET_GESTURE_MULTIFINGER_SWIPE_3; 171 return UMA_ET_GESTURE_MULTIFINGER_SWIPE_3;
169 return UMA_ET_GESTURE_MULTIFINGER_SWIPE; 172 return UMA_ET_GESTURE_MULTIFINGER_SWIPE_4P;
170 } 173 }
171 case ui::ET_GESTURE_WIN8_EDGE_SWIPE: 174 case ui::ET_GESTURE_WIN8_EDGE_SWIPE:
172 return UMA_ET_GESTURE_WIN8_EDGE_SWIPE; 175 return UMA_ET_GESTURE_WIN8_EDGE_SWIPE;
173 case ui::ET_GESTURE_TAP_CANCEL: 176 case ui::ET_GESTURE_TAP_CANCEL:
174 return UMA_ET_GESTURE_TAP_CANCEL; 177 return UMA_ET_GESTURE_TAP_CANCEL;
175 case ui::ET_GESTURE_SHOW_PRESS: 178 case ui::ET_GESTURE_SHOW_PRESS:
176 return UMA_ET_GESTURE_SHOW_PRESS; 179 return UMA_ET_GESTURE_SHOW_PRESS;
177 case ui::ET_SCROLL: 180 case ui::ET_SCROLL:
178 return UMA_ET_SCROLL; 181 return UMA_ET_SCROLL;
179 case ui::ET_SCROLL_FLING_START: 182 case ui::ET_SCROLL_FLING_START:
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 return GESTURE_OMNIBOX_SCROLL; 466 return GESTURE_OMNIBOX_SCROLL;
464 if (event.type() == ui::ET_GESTURE_PINCH_BEGIN) 467 if (event.type() == ui::ET_GESTURE_PINCH_BEGIN)
465 return GESTURE_OMNIBOX_PINCH; 468 return GESTURE_OMNIBOX_PINCH;
466 return GESTURE_UNKNOWN; 469 return GESTURE_UNKNOWN;
467 } 470 }
468 471
469 return GESTURE_UNKNOWN; 472 return GESTURE_UNKNOWN;
470 } 473 }
471 474
472 } // namespace ash 475 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/gestures/overview_gesture_handler.cc » ('j') | ash/wm/toplevel_window_event_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698