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

Unified Diff: Source/core/html/HTMLMediaElement.h

Issue 1179223002: Implement autoplay gesture override experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Refactored into AutoplayExperimentHelper. Created 5 years, 4 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: Source/core/html/HTMLMediaElement.h
diff --git a/Source/core/html/HTMLMediaElement.h b/Source/core/html/HTMLMediaElement.h
index 2f1bea3fc8f96c6333f9c3c7361d47bcf86982df..9e98603a4c3a36ae444441fada49feb63cb78b03 100644
--- a/Source/core/html/HTMLMediaElement.h
+++ b/Source/core/html/HTMLMediaElement.h
@@ -29,6 +29,7 @@
#include "core/CoreExport.h"
#include "core/dom/ActiveDOMObject.h"
#include "core/events/GenericEventQueue.h"
+#include "core/html/AutoplayExperimentHelper.h"
#include "core/html/HTMLElement.h"
#include "core/html/track/TextTrack.h"
#include "platform/Supplementable.h"
@@ -390,7 +391,13 @@ private:
// This does not check user gesture restrictions.
void playInternal();
- void gesturelessInitialPlayHalted();
+ // If we are about to enter a stopped state, call this to record
philipj_slow 2015/08/13 10:15:40 s/stop/pause/, media elements don't really have a
liberato (no reviews please) 2015/09/01 06:54:20 updated, and the metric names. was trying not to
+ // autoplay metrics. If we were already in a stopped state, then
+ // this does nothing.
+ void recordMetricsIfStopping();
+ // Could stopping at this point be considered a bailout of playback?
+ // (as in, "The user really didn't want to play this").
+ bool isBailout() const;
void autoplayMediaEncountered();
void allowVideoRendering();
@@ -426,6 +433,8 @@ private:
bool isBlockedOnMediaController() const;
bool isAutoplaying() const { return m_autoplaying; }
+ void recordAutoplayMetric(AutoplayMetrics);
+
WebMediaPlayer::CORSMode corsMode() const;
// Returns the "direction of playback" value as specified in the HTML5 spec.
@@ -445,6 +454,12 @@ private:
// transition to HAVE_METADATA.
void selectInitialTracksIfNecessary();
+ // Return true if and only if we require a user gesture before letting
+ // the media play.
+ bool isUserGestureRequiredForPlay() const;
+ void removeUserGestureRequirement();
+ void setInitialPlayWithoutUserGestures(bool);
+
void audioTracksTimerFired(Timer<HTMLMediaElement>*);
Timer<HTMLMediaElement> m_loadTimer;
@@ -617,6 +632,9 @@ private:
friend class Internals;
friend class TrackDisplayUpdateScope;
+ friend class AutoplayExperimentHelper;
+
+ AutoplayExperimentHelper m_autoplayHelper;
static URLRegistry* s_mediaStreamRegistry;
};

Powered by Google App Engine
This is Rietveld 408576698