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

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

Issue 2804913004: Use hasReceivedUserGesture for collecting vibrate metrics on user gesture. (Closed)
Patch Set: Use hasReceivedUserGesture for vibrate metrics collecting. 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return false; 97 return false;
98 } 98 }
99 99
100 return NavigatorVibration::from(navigator).controller(*frame)->vibrate( 100 return NavigatorVibration::from(navigator).controller(*frame)->vibrate(
101 pattern); 101 pattern);
102 } 102 }
103 103
104 // static 104 // static
105 void NavigatorVibration::collectHistogramMetrics(const LocalFrame& frame) { 105 void NavigatorVibration::collectHistogramMetrics(const LocalFrame& frame) {
106 NavigatorVibrationType type; 106 NavigatorVibrationType type;
107 bool userGesture = UserGestureIndicator::processingUserGesture(); 107 bool userGesture = frame.hasReceivedUserGesture();
108 UseCounter::count(&frame, UseCounter::NavigatorVibrate); 108 UseCounter::count(&frame, UseCounter::NavigatorVibrate);
109 if (!frame.isMainFrame()) { 109 if (!frame.isMainFrame()) {
110 UseCounter::count(&frame, UseCounter::NavigatorVibrateSubFrame); 110 UseCounter::count(&frame, UseCounter::NavigatorVibrateSubFrame);
111 if (frame.isCrossOriginSubframe()) { 111 if (frame.isCrossOriginSubframe()) {
112 if (userGesture) 112 if (userGesture)
113 type = NavigatorVibrationType::CrossOriginSubFrameWithUserGesture; 113 type = NavigatorVibrationType::CrossOriginSubFrameWithUserGesture;
114 else 114 else
115 type = NavigatorVibrationType::CrossOriginSubFrameNoUserGesture; 115 type = NavigatorVibrationType::CrossOriginSubFrameNoUserGesture;
116 } else { 116 } else {
117 if (userGesture) 117 if (userGesture)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 } 166 }
167 167
168 DEFINE_TRACE(NavigatorVibration) { 168 DEFINE_TRACE(NavigatorVibration) {
169 visitor->trace(m_controller); 169 visitor->trace(m_controller);
170 Supplement<Navigator>::trace(visitor); 170 Supplement<Navigator>::trace(visitor);
171 ContextLifecycleObserver::trace(visitor); 171 ContextLifecycleObserver::trace(visitor);
172 } 172 }
173 173
174 } // namespace blink 174 } // 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