Chromium Code Reviews| 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..2e82f6fc650068f71f2a4a278411932011c458c0 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,22 @@ void NavigatorVibration::collectHistogramMetrics(const LocalFrame& frame) { |
| DEFINE_STATIC_LOCAL(EnumerationHistogram, NavigatorVibrateHistogram, |
| ("Vibration.Context", NavigatorVibrationType::EnumMax)); |
| NavigatorVibrateHistogram.count(type); |
| + |
| + mojom::blink::EngagementLevel level = frame.document()->getEngagementLevel(); |
| + if (level == mojom::blink::EngagementLevel::NONE) |
|
haraken
2017/01/06 00:56:27
Shall we use a switch statement?
dominickn
2017/01/06 01:38:34
Done - though it's a bit more verbose as a result.
|
| + UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementNone); |
| + else if (level == mojom::blink::EngagementLevel::MINIMAL) |
| + UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementMinimal); |
| + else if (level == mojom::blink::EngagementLevel::LOW) |
| + UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementLow); |
| + else if (level == mojom::blink::EngagementLevel::MEDIUM) |
| + UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementMedium); |
| + else if (level == mojom::blink::EngagementLevel::HIGH) |
| + UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementHigh); |
| + else if (level == mojom::blink::EngagementLevel::MAX) |
| + UseCounter::count(&frame, UseCounter::NavigatorVibrateEngagementMax); |
| + else |
| + NOTREACHED(); |
| } |
| VibrationController* NavigatorVibration::controller(const LocalFrame& frame) { |