| 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 381083a684e67c91462a9dad5ab7004e7222979c..aed388fec02c2ff5ee9881406f4cc96eb456be71 100644
|
| --- a/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.h
|
| +++ b/third_party/WebKit/Source/core/html/AutoplayExperimentHelper.h
|
| @@ -112,7 +112,7 @@ public:
|
| virtual bool muted() const = 0;
|
| virtual void setMuted(bool) = 0;
|
| virtual void playInternal() = 0;
|
| - virtual bool isUserGestureRequiredForPlay() const = 0;
|
| + virtual bool isLockedPendingUserGesture() const = 0;
|
| virtual void removeUserGestureRequirement() = 0;
|
| virtual void recordAutoplayMetric(AutoplayMetrics) = 0;
|
| virtual bool shouldAutoplay() = 0;
|
| @@ -143,10 +143,9 @@ public:
|
| ~AutoplayExperimentHelper();
|
|
|
| void becameReadyToPlay();
|
| - void playMethodCalled();
|
| + void playMethodCalled(bool playing);
|
| void pauseMethodCalled();
|
| void loadMethodCalled();
|
| - void mutedChanged();
|
| void positionChanged(const IntRect&);
|
| void updatePositionNotificationRegistration();
|
| void recordSandboxFailure();
|
| @@ -167,6 +166,18 @@ public:
|
| // gesture requirement, then this does nothing.
|
| void removeUserGestureRequirement(AutoplayMetrics);
|
|
|
| + // Set the reason that we're overridding the user gesture. If there is no
|
| + // gesture requirement, then this does nothing.
|
| + void setDeferredOverrideReason(AutoplayMetrics);
|
| +
|
| + // Return true if and only if the user gesture requirement is currently
|
| + // overridden by the experiment, permitting playback.
|
| + bool isGestureRequirementOverridden() const;
|
| +
|
| + // Return true if and only if playback is queued but hasn't started yet,
|
| + // such as if the element doesn't meet visibility requirements.
|
| + bool isPlaybackDeferred() const;
|
| +
|
| // Set the position to the current view's position, and
|
| void triggerAutoplayViewportCheckForTesting();
|
|
|
| @@ -210,10 +221,22 @@ private:
|
| // Un-register for position updates, if we are currently registered.
|
| void unregisterForPositionUpdatesIfNeeded();
|
|
|
| + // Modifiers for checking isEligible().
|
| + enum EligibilityMode {
|
| + // Perform all normal eligibility checks.
|
| + Normal = 0,
|
| +
|
| + // Perform normal eligibility checks, but skip checking if autoplay has
|
| + // actually been requested. In other words, don't fail just becase
|
| + // nobody has called play() and/or set the autoplay attribute.
|
| + IgnorePendingPlayback = 1
|
| + };
|
| +
|
| // 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.
|
| - bool isEligible() const;
|
| + // |mode| modifies the eligibility check, as described above.
|
| + bool isEligible(EligibilityMode = Normal) const;
|
|
|
| // Return false if and only if m_element is not visible, and we care
|
| // that it must be visible.
|
| @@ -249,7 +272,7 @@ private:
|
|
|
| Client& client() const;
|
|
|
| - bool isUserGestureRequiredForPlay() const;
|
| + bool isLockedPendingUserGesture() const;
|
|
|
| inline bool enabled(Mode mode) const
|
| {
|
|
|