Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/HTMLMediaElement.h |
| diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.h b/third_party/WebKit/Source/core/html/HTMLMediaElement.h |
| index 6d9157f8db8f8c50a7e3d6a60212167a8dedaf9e..83f70026f13c14ffe0fa367a55f2f7e471debe6f 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.h |
| +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.h |
| @@ -132,8 +132,8 @@ public: |
| TimeRanges* seekable() const; |
| bool ended() const; |
| bool autoplay() const; |
| - enum class RecordMetricsBehavior { DoNotRecord, DoRecord }; |
| - bool shouldAutoplay(const RecordMetricsBehavior = RecordMetricsBehavior::DoNotRecord); |
| + using RecordMetricsBehavior = AutoplayExperimentHelper::Client::RecordMetricsBehavior; |
| + bool shouldAutoplay(const AutoplayExperimentHelper::Client::RecordMetricsBehavior = RecordMetricsBehavior::DoNotRecord); |
| bool loop() const; |
| void setLoop(bool); |
| void play(); |
| @@ -270,6 +270,8 @@ protected: |
| DisplayMode displayMode() const { return m_displayMode; } |
| virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } |
| + void recordAutoplayMetric(AutoplayMetrics); |
| + |
| private: |
| void resetMediaPlayerAndMediaSource(); |
| @@ -375,14 +377,6 @@ private: |
| // This does not change the buffering strategy. |
| void pauseInternal(); |
| - // If we are about to enter a paused state, call this to record |
| - // autoplay metrics. If we were already in a stopped state, then |
| - // this does nothing. |
| - void recordMetricsIfPausing(); |
| - // 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(); |
| void updateVolume(); |
| @@ -414,8 +408,6 @@ private: |
| void setAllowHiddenVolumeControls(bool); |
| - void recordAutoplayMetric(AutoplayMetrics); |
| - |
| WebMediaPlayer::CORSMode corsMode() const; |
| // Returns the "direction of playback" value as specified in the HTML5 spec. |
| @@ -435,8 +427,11 @@ private: |
| // Return true if and only if we require a user gesture before letting |
| // the media play. |
| bool isUserGestureRequiredForPlay() const; |
| + |
| + // If the user gesture is required, then this will remove it. Note that |
| + // one should not generally call this method directly; use the one on |
| + // m_helper and give it a reason. |
| void removeUserGestureRequirement(); |
| - void setInitialPlayWithoutUserGestures(bool); |
| void setNetworkState(NetworkState); |
| @@ -541,8 +536,6 @@ private: |
| bool m_remoteRoutesAvailable : 1; |
| bool m_playingRemotely : 1; |
| bool m_isFinalizing : 1; |
| - bool m_initialPlayWithoutUserGesture : 1; |
| - bool m_autoplayMediaCounted : 1; |
| // Whether this element is in overlay fullscreen mode. |
| bool m_inOverlayFullscreenVideo : 1; |
| @@ -612,7 +605,41 @@ private: |
| friend class AutoplayExperimentHelper; |
| friend class MediaControlsTest; |
| - AutoplayExperimentHelper m_autoplayHelper; |
| + class AutoplayHelperClientImpl : public AutoplayExperimentHelper::Client { |
|
sof
2016/02/16 08:40:06
You need to turn this into an Oilpan controlled ob
liberato (no reviews please)
2016/02/24 18:44:06
declaring this to be a subclass of NoBase... cause
|
| + public: |
| + AutoplayHelperClientImpl(HTMLMediaElement* element) : m_element(element) {} |
| + virtual ~AutoplayHelperClientImpl(); |
| + |
| + double currentTime() const override { return m_element->currentTime(); } |
| + double duration() const override { return m_element->duration(); } |
| + bool paused() const override { return m_element->paused(); } |
| + bool muted() const override { return m_element->muted(); } |
| + void setMuted(bool muted) override { m_element->setMuted(muted); } |
| + void playInternal() override { m_element->playInternal(); } |
| + bool isUserGestureRequiredForPlay() const override { return m_element->isUserGestureRequiredForPlay(); } |
| + void removeUserGestureRequirement() override { m_element->removeUserGestureRequirement(); } |
| + void recordAutoplayMetric(AutoplayMetrics metric) override { m_element->recordAutoplayMetric(metric); } |
| + bool shouldAutoplay(RecordMetricsBehavior behavior) override { return m_element->shouldAutoplay(behavior); } |
| + bool isHTMLVideoElement() const override { return m_element->isHTMLVideoElement(); } |
| + bool isHTMLAudioElement() const override { return m_element->isHTMLAudioElement(); } |
| + |
| + // Document |
| + bool isLegacyViewportType() override; |
| + PageVisibilityState pageVisibilityState() const override; |
| + String autoplayExperimentMode() const override; |
| + |
| + // LayoutObject |
| + void setRequestPositionUpdates(bool) override; |
| + IntRect absoluteBoundingBoxRect() const override; |
| + |
| + private: |
| + // AutoplayHelperClientImpl is destroyed by HTMLMediaElement, and is |
| + // not itself GC'd. |
| + RawPtrWillBeUntracedMember<HTMLMediaElement> m_element; |
|
sof
2016/02/16 08:40:06
RawPtrWillBeMember<HTMLMediaElement> + it needs to
liberato (no reviews please)
2016/02/24 18:44:06
Done.
|
| + }; |
| + |
| + OwnPtr<AutoplayExperimentHelper::Client> m_autoplayHelperClient; |
|
sof
2016/02/16 08:40:06
OwnPtrWillBeMember<..> + it needs to be traced.
liberato (no reviews please)
2016/02/24 18:44:05
Done.
|
| + OwnPtr<AutoplayExperimentHelper> m_autoplayHelper; |
|
sof
2016/02/16 08:40:06
OwnPtrWillBeMemer<AutoplayExperimentHelper> m_auto
liberato (no reviews please)
2016/02/24 18:44:05
Done.
|
| static URLRegistry* s_mediaStreamRegistry; |
| }; |