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

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

Issue 1853543002: Add -ifsameorigin to autoplay experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autoplay
Patch Set: irebased. 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.h
diff --git a/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.h b/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.h
index 6595de029456a634bddb6e137012abec839ea645..2287c1e5377bf5dc68e553b7c1551aca8b6a8957 100644
--- a/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.h
+++ b/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.h
@@ -123,6 +123,7 @@ public:
virtual bool isLegacyViewportType() = 0;
virtual PageVisibilityState pageVisibilityState() const = 0;
virtual String autoplayExperimentMode() const = 0;
+ virtual LocalFrame* frame() const = 0;
// LayoutObject
virtual void setRequestPositionUpdates(bool) = 0;
@@ -183,9 +184,15 @@ public:
// Restrict gestureless autoplay to sites which contain the
// viewport tag.
IfMobile = 1 << 5,
+ // Restrict gestureless autoplay to sites which are from the same origin
+ // as the top-level frame.
+ IfSameOrigin = 1 << 6,
+ // When combined with IfSameOrigin, allow muted to override the same
+ // origin check. Else, this does nothing.
+ OrMuted = 1 << 7,
// If gestureless autoplay is allowed, then mute the media before
// starting to play.
- PlayMuted = 1 << 6,
+ PlayMuted = 1 << 8,
};
DEFINE_INLINE_TRACE() { visitor->trace(m_client); }
@@ -200,6 +207,10 @@ private:
// Un-register for position updates, if we are currently registered.
void unregisterForPositionUpdatesIfNeeded();
+ // Return true if and only if our media element is in the same origin as the
+ // top-level frame.
+ bool isSameOrigin() const;
+
// Return true if any only if this player meets (most) of the eligibility
// requirements for the experiment to override the need for a user
// gesture. This includes everything except the visibility test.

Powered by Google App Engine
This is Rietveld 408576698