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

Side by Side Diff: third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp

Issue 2801363002: Use hasReceivedUserGesture for collecting vibrate metrics on user gesture. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Samsung Electronics 2 * Copyright (C) 2012 Samsung Electronics
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return false; 98 return false;
99 } 99 }
100 100
101 return NavigatorVibration::from(navigator).controller(*frame)->vibrate( 101 return NavigatorVibration::from(navigator).controller(*frame)->vibrate(
102 pattern); 102 pattern);
103 } 103 }
104 104
105 // static 105 // static
106 void NavigatorVibration::collectHistogramMetrics(const LocalFrame& frame) { 106 void NavigatorVibration::collectHistogramMetrics(const LocalFrame& frame) {
107 NavigatorVibrationType type; 107 NavigatorVibrationType type;
108 bool userGesture = UserGestureIndicator::processingUserGesture(); 108 bool userGesture = frame.hasReceivedUserGesture();
109 UseCounter::count(&frame, UseCounter::NavigatorVibrate); 109 UseCounter::count(&frame, UseCounter::NavigatorVibrate);
110 if (!frame.isMainFrame()) { 110 if (!frame.isMainFrame()) {
111 UseCounter::count(&frame, UseCounter::NavigatorVibrateSubFrame); 111 UseCounter::count(&frame, UseCounter::NavigatorVibrateSubFrame);
112 if (frame.isCrossOriginSubframe()) { 112 if (frame.isCrossOriginSubframe()) {
113 if (userGesture) 113 if (userGesture)
114 type = NavigatorVibrationType::CrossOriginSubFrameWithUserGesture; 114 type = NavigatorVibrationType::CrossOriginSubFrameWithUserGesture;
115 else 115 else
116 type = NavigatorVibrationType::CrossOriginSubFrameNoUserGesture; 116 type = NavigatorVibrationType::CrossOriginSubFrameNoUserGesture;
117 } else { 117 } else {
118 if (userGesture) 118 if (userGesture)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 } 167 }
168 168
169 DEFINE_TRACE(NavigatorVibration) { 169 DEFINE_TRACE(NavigatorVibration) {
170 visitor->trace(m_controller); 170 visitor->trace(m_controller);
171 Supplement<Navigator>::trace(visitor); 171 Supplement<Navigator>::trace(visitor);
172 ContextLifecycleObserver::trace(visitor); 172 ContextLifecycleObserver::trace(visitor);
173 } 173 }
174 174
175 } // namespace blink 175 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698