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

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

Issue 2052623002: [Android, Media] Enable autoplay settings for muted autoplay, wired them up to the media element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-settings-npe
Patch Set: Created 4 years, 6 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 50c260c45b7fe8fa549208ac4a36478718a08463..663ea7d70ae7a8c59d05c8163770a43796803610 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -3689,6 +3689,9 @@ bool HTMLMediaElement::isGestureNeededForPlayback()
if (!m_lockedPendingUserGesture)
return false;
+ if (!isAutoplayAllowedPerSettings())
+ return true;
mlamouri (slow - plz ping) 2016/06/09 11:15:07 I don't think that's okay. It will allow content s
whywhat 2016/06/09 19:42:39 Only check it after the check below.
+
if (muted() && RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) {
m_isAutoplayingMuted = true;
return false;
@@ -3700,6 +3703,15 @@ bool HTMLMediaElement::isGestureNeededForPlayback()
return true;
}
+bool HTMLMediaElement::isAutoplayAllowedPerSettings() const
+{
+ LocalFrame* frame = document().frame();
+ if (!frame)
+ return false;
+ FrameLoaderClient* frameLoaderClient = frame->loader().client();
+ return frameLoaderClient && frameLoaderClient->allowAutoplay(false);
+}
+
void HTMLMediaElement::setNetworkState(NetworkState state)
{
if (m_networkState != state) {
@@ -3924,11 +3936,7 @@ String HTMLMediaElement::AutoplayHelperClientImpl::autoplayExperimentMode() cons
bool HTMLMediaElement::AutoplayHelperClientImpl::isAutoplayAllowedPerSettings() const
{
- LocalFrame* frame = m_element->document().frame();
- if (!frame)
- return false;
- FrameLoaderClient* frameLoaderClient = frame->loader().client();
- return frameLoaderClient && frameLoaderClient->allowAutoplay(false);
+ return m_element->isAutoplayAllowedPerSettings();
}
void HTMLMediaElement::AutoplayHelperClientImpl::setRequestPositionUpdates(bool request)

Powered by Google App Engine
This is Rietveld 408576698