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

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

Issue 2813303005: [Blink>Media] Moving autoplay logic to AutoplayPolicy (Closed)
Patch Set: fixed event order for setMuted and added comments Created 3 years, 8 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.h
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.h b/third_party/WebKit/Source/core/html/HTMLMediaElement.h
index c61d5df71763a3c9d41c088da17afab4f569ccb3..0c37b08f7af06fb457e6c3f273a4dda5ae158f14 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.h
@@ -51,10 +51,10 @@ namespace blink {
class AudioSourceProviderClient;
class AudioTrack;
class AudioTrackList;
+class AutoplayPolicy;
class AutoplayUmaHelper;
class ContentType;
class CueTimeline;
-class ElementVisibilityObserver;
class EnumerationHistogram;
class Event;
class ExceptionState;
@@ -330,6 +330,9 @@ class CORE_EXPORT HTMLMediaElement
return remote_playback_client_;
}
+ const AutoplayPolicy& autoplay_policy() const { return *autoplay_policy_; }
+ AutoplayUmaHelper& autoplay_uma_helper() { return *autoplay_uma_helper_; }
mlamouri (slow - plz ping) 2017/04/18 13:28:28 For some reasons, Blink coding style doesn't allow
Zhiqiang Zhang (Slow) 2017/04/18 16:56:44 Done.
+
protected:
HTMLMediaElement(const QualifiedName&, Document&);
~HTMLMediaElement() override;
@@ -524,33 +527,6 @@ class CORE_EXPORT HTMLMediaElement
// transition to kHaveMetadata.
void SelectInitialTracksIfNecessary();
- // Return true if and only if a user gesture is required to unlock this
- // media element for unrestricted autoplay / script control. Don't confuse
- // this with isGestureNeededForPlayback(). The latter is usually what one
- // should use, if checking to see if an action is allowed.
- bool IsLockedPendingUserGesture() const;
-
- bool IsLockedPendingUserGestureIfCrossOriginExperimentEnabled() 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 UnlockUserGesture();
-
- // Return true if and only if a user gesture is requried for playback. Even
- // if isLockedPendingUserGesture() return true, this might return false if
- // the requirement is currently overridden. This does not check if a user
- // gesture is currently being processed.
- bool IsGestureNeededForPlayback() const;
-
- bool IsGestureNeededForPlaybackIfCrossOriginExperimentEnabled() const;
-
- bool IsGestureNeededForPlaybackIfPendingUserGestureIsLocked() const;
-
- // Return true if and only if the settings allow autoplay of media on this
- // frame.
- bool IsAutoplayAllowedPerSettings() const;
-
void SetNetworkState(NetworkState);
void AudioTracksTimerFired(TimerBase*);
@@ -565,8 +541,6 @@ class CORE_EXPORT HTMLMediaElement
EnumerationHistogram& ShowControlsHistogram() const;
- void OnVisibilityChangedForAutoplay(bool is_visible);
-
void ViewportFillDebouncerTimerFired(TimerBase*);
TaskRunnerTimer<HTMLMediaElement> load_timer_;
@@ -652,8 +626,6 @@ class CORE_EXPORT HTMLMediaElement
PendingActionFlags pending_action_flags_;
// FIXME: HTMLMediaElement has way too many state bits.
- bool locked_pending_user_gesture_ : 1;
- bool locked_pending_user_gesture_if_cross_origin_experiment_enabled_ : 1;
bool playing_ : 1;
bool should_delay_load_event_ : 1;
bool have_fired_loaded_data_ : 1;
@@ -745,7 +717,7 @@ class CORE_EXPORT HTMLMediaElement
AudioSourceProviderImpl audio_source_provider_;
- friend class AutoplayUmaHelper; // for isAutoplayAllowedPerSettings
+ friend class AutoplayPolicy;
friend class AutoplayUmaHelperTest;
friend class Internals;
friend class TrackDisplayUpdateScope;
@@ -755,13 +727,11 @@ class CORE_EXPORT HTMLMediaElement
friend class HTMLVideoElement;
friend class MediaControlsOrientationLockDelegateTest;
+ Member<AutoplayPolicy> autoplay_policy_;
Member<AutoplayUmaHelper> autoplay_uma_helper_;
mlamouri (slow - plz ping) 2017/04/18 13:28:28 How hard would it be to move `autoplay_uma_helper_
Zhiqiang Zhang (Slow) 2017/04/18 16:56:44 Makes sense. Done :)
WebRemotePlaybackClient* remote_playback_client_;
- // class AutoplayVisibilityObserver;
- Member<ElementVisibilityObserver> autoplay_visibility_observer_;
-
IntRect current_intersect_rect_;
Member<MediaControls> media_controls_;

Powered by Google App Engine
This is Rietveld 408576698