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

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

Issue 2529593002: Use utilizeUserGesture() everywhere in HTMLMediaElement (Closed)
Patch Set: rebase on https://codereview.chromium.org/2510353004/ Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 26a0c879ca69182999a93fcefe9c9d1258c13e6b..5c322c5665496a0f19ab9ec89bd5852851f5dab9 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -2035,7 +2035,7 @@ bool HTMLMediaElement::autoplay() const {
return fastHasAttribute(autoplayAttr);
}
-bool HTMLMediaElement::shouldAutoplay() {
+bool HTMLMediaElement::shouldAutoplay() const {
if (document().isSandboxed(SandboxAutomaticFeatures))
return false;
return m_autoplaying && m_paused && autoplay();
@@ -2147,7 +2147,9 @@ ScriptPromise HTMLMediaElement::playForBindings(ScriptState* scriptState) {
Nullable<ExceptionCode> HTMLMediaElement::play() {
BLINK_MEDIA_LOG << "play(" << (void*)this << ")";
- if (!UserGestureIndicator::processingUserGesture()) {
+ if (UserGestureIndicator::utilizeUserGesture()) {
Rick Byers 2016/11/25 15:51:59 This is just a semantics-preserving cleanup, right
foolip 2016/11/28 15:13:05 This preserved behavior, yes. If utilizeUserGestu
mlamouri (slow - plz ping) 2016/12/01 10:24:50 I'm not Rick, but reading the header file, I would
+ unlockUserGesture();
+ } else {
m_autoplayUmaHelper->onAutoplayInitiated(AutoplaySource::Method);
if (isGestureNeededForPlayback()) {
// If we're already playing, then this play would do nothing anyway.
@@ -2164,9 +2166,6 @@ Nullable<ExceptionCode> HTMLMediaElement::play() {
JSMessageSource, WarningMessageLevel, message));
return NotAllowedError;
}
- } else {
- UserGestureIndicator::utilizeUserGesture();
- unlockUserGesture();
}
if (m_error && m_error->code() == MediaError::kMediaErrSrcNotSupported)
@@ -2351,7 +2350,7 @@ void HTMLMediaElement::setMuted(bool muted) {
bool wasPendingAutoplayMuted = m_autoplayVisibilityObserver && paused() &&
m_muted && isLockedPendingUserGesture();
- if (UserGestureIndicator::processingUserGesture())
+ if (UserGestureIndicator::utilizeUserGesture())
Rick Byers 2016/11/25 15:51:59 It's not clear to me that utilizeUserGesture is ap
foolip 2016/11/28 15:13:05 The documentation says "consider calling utilizeUs
mlamouri (slow - plz ping) 2016/12/01 10:24:50 That one is harder because we eagerly unlock but d
unlockUserGesture();
m_muted = muted;
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698