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

Unified Diff: third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp

Issue 1853543002: Add -ifsameorigin to autoplay experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autoplay
Patch Set: comment. Created 4 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/AutoplayExperimentHelper.cpp
diff --git a/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp b/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp
index bbfbbe36f2c0692d0d8d03247198e7fff8e36e28..80ead256c3e68e9c3b13db9a8171fbf7799cfa95 100644
--- a/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp
+++ b/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp
@@ -327,6 +327,10 @@ bool AutoplayExperimentHelper::isEligible() const
&& !client().isLegacyViewportType())
return false;
+ // If we require same-origin, then check the origin.
+ if (enabled(IfSameOrigin) && client().isCrossOrigin())
+ return false;
+
// If we require muted media and this is muted, then it is eligible.
if (enabled(IfMuted))
return client().muted();
@@ -394,6 +398,8 @@ AutoplayExperimentHelper::Mode AutoplayExperimentHelper::fromString(const String
value |= IfMuted;
if (mode.contains("-ifmobile"))
value |= IfMobile;
+ if (mode.contains("-ifsameorigin"))
+ value |= IfSameOrigin;
if (mode.contains("-playmuted"))
value |= PlayMuted;

Powered by Google App Engine
This is Rietveld 408576698