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

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

Issue 2640143002: Allow autoplay unmuted for WebAPK in the manifest scope (Closed)
Patch Set: addressed nits Created 3 years, 10 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/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index 9156bba583b6c602b3a8cc84b4db479d0b50a85d..87666f21b4fbeb866e3c2dd572ee077afbd92cb6 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -293,12 +293,27 @@ bool isDocumentCrossOrigin(Document& document) {
return frame && frame->isCrossOriginSubframe();
}
+bool isDocumentWhitelisted(Document& document) {
+ DCHECK(document.settings());
+
+ const String& whitelistScope =
+ document.settings()->getMediaPlaybackGestureWhitelistScope();
+ if (whitelistScope.isNull() || whitelistScope.isEmpty())
+ return false;
+
+ return document.url().getString().startsWith(whitelistScope);
+}
+
// Return true if and only if the document settings specifies media playback
// requires user gesture.
bool computeLockedPendingUserGesture(Document& document) {
if (!document.settings())
return false;
+ if (isDocumentWhitelisted(document)) {
+ return false;
+ }
+
if (document.settings()->getCrossOriginMediaPlaybackRequiresUserGesture() &&
isDocumentCrossOrigin(document)) {
return true;
« no previous file with comments | « third_party/WebKit/Source/core/frame/Settings.json5 ('k') | third_party/WebKit/Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698