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

Unified Diff: third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp

Issue 2813303005: [Blink>Media] Moving autoplay logic to AutoplayPolicy (Closed)
Patch Set: addressed nits 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp
diff --git a/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp b/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp
index a706ffbebf58d6ffeb1f3662d7f6c040aacbac87..410dcc50e41ceff3d8ab904d199a1d7c02fe58e0 100644
--- a/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp
+++ b/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp
@@ -8,7 +8,9 @@
#include "core/dom/ElementVisibilityObserver.h"
#include "core/events/Event.h"
#include "core/frame/Settings.h"
+#include "core/frame/UseCounter.h"
#include "core/html/HTMLMediaElement.h"
+#include "core/html/media/AutoplayPolicy.h"
#include "platform/Histogram.h"
#include "platform/wtf/CurrentTime.h"
#include "public/platform/Platform.h"
@@ -110,7 +112,8 @@ void AutoplayUmaHelper::OnAutoplayInitiated(AutoplaySource source) {
bool data_saver_enabled =
element_->GetDocument().GetSettings() &&
element_->GetDocument().GetSettings()->GetDataSaverEnabled();
- bool blocked_by_setting = !element_->IsAutoplayAllowedPerSettings();
+ bool blocked_by_setting =
+ !element_->GetAutoplayPolicy().IsAutoplayAllowedPerSettings();
if (data_saver_enabled && blocked_by_setting) {
blocked_muted_video_histogram.Count(
@@ -213,6 +216,13 @@ void AutoplayUmaHelper::RecordAutoplayUnmuteStatus(
autoplay_unmute_histogram.Count(static_cast<int>(status));
}
+void AutoplayUmaHelper::VideoWillBeDrawnToCanvas() {
+ if (HasSource() && !IsVisible()) {
+ UseCounter::Count(element_->GetDocument(),
+ UseCounter::kHiddenAutoplayedVideoInCanvas);
+ }
+}
+
void AutoplayUmaHelper::DidMoveToNewDocument(Document& old_document) {
if (!ShouldListenToContextDestroyed())
return;

Powered by Google App Engine
This is Rietveld 408576698