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

Unified Diff: third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp

Issue 2614913005: Add UseCounters for navigator.vibrate usage compared to site engagement. (Closed)
Patch Set: Address comment Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp
diff --git a/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp b/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp
index 95e5b353ce92c7bb4da370d38504a524671702ad..2fdd183a527e9104de4ead5ba188945adfcce3c4 100644
--- a/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp
+++ b/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp
@@ -29,6 +29,7 @@
#include "modules/vibration/VibrationController.h"
#include "platform/Histogram.h"
#include "platform/UserGestureIndicator.h"
+#include "public/platform/site_engagement.mojom-blink.h"
namespace blink {
@@ -124,6 +125,27 @@ void NavigatorVibration::collectHistogramMetrics(const LocalFrame& frame) {
DEFINE_STATIC_LOCAL(EnumerationHistogram, NavigatorVibrateHistogram,
("Vibration.Context", NavigatorVibrationType::EnumMax));
NavigatorVibrateHistogram.count(type);
+
+ switch (frame.document()->getEngagementLevel()) {
+ case mojom::blink::EngagementLevel::NONE:
+ UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementNone);
+ break;
+ case mojom::blink::EngagementLevel::MINIMAL:
+ UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementMinimal);
+ break;
+ case mojom::blink::EngagementLevel::LOW:
+ UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementLow);
+ break;
+ case mojom::blink::EngagementLevel::MEDIUM:
+ UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementMedium);
+ break;
+ case mojom::blink::EngagementLevel::HIGH:
+ UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementHigh);
+ break;
+ case mojom::blink::EngagementLevel::MAX:
+ UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementMax);
+ break;
+ }
}
VibrationController* NavigatorVibration::controller(const LocalFrame& frame) {
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | third_party/WebKit/Source/modules/vibration/VibrationController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698