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

Side by Side Diff: third_party/WebKit/Source/core/html/AutoplayExperimentHelper.h

Issue 1938443002: Allow muted third-party autoplay with -ormuted experiment option. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed unused flag. Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef AutoplayExperimentHelper_h 5 #ifndef AutoplayExperimentHelper_h
6 #define AutoplayExperimentHelper_h 6 #define AutoplayExperimentHelper_h
7 7
8 #include "core/page/Page.h" 8 #include "core/page/Page.h"
9 #include "platform/Timer.h" 9 #include "platform/Timer.h"
10 #include "platform/geometry/IntRect.h" 10 #include "platform/geometry/IntRect.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 virtual ~Client() {} 106 virtual ~Client() {}
107 107
108 // HTMLMediaElement 108 // HTMLMediaElement
109 virtual double currentTime() const = 0; 109 virtual double currentTime() const = 0;
110 virtual double duration() const = 0; 110 virtual double duration() const = 0;
111 virtual bool paused() const = 0; 111 virtual bool paused() const = 0;
112 virtual bool ended() const = 0; 112 virtual bool ended() const = 0;
113 virtual bool muted() const = 0; 113 virtual bool muted() const = 0;
114 virtual void setMuted(bool) = 0; 114 virtual void setMuted(bool) = 0;
115 virtual void playInternal() = 0; 115 virtual void playInternal() = 0;
116 virtual void pauseInternal() = 0;
116 virtual bool isLockedPendingUserGesture() const = 0; 117 virtual bool isLockedPendingUserGesture() const = 0;
117 virtual void unlockUserGesture() = 0; 118 virtual void unlockUserGesture() = 0;
118 virtual void recordAutoplayMetric(AutoplayMetrics) = 0; 119 virtual void recordAutoplayMetric(AutoplayMetrics) = 0;
119 virtual bool shouldAutoplay() = 0; 120 virtual bool shouldAutoplay() = 0;
120 virtual bool isHTMLVideoElement() const = 0; 121 virtual bool isHTMLVideoElement() const = 0;
121 virtual bool isHTMLAudioElement() const = 0; 122 virtual bool isHTMLAudioElement() const = 0;
122 123
123 // Document 124 // Document
124 virtual bool isLegacyViewportType() = 0; 125 virtual bool isLegacyViewportType() = 0;
125 virtual PageVisibilityState pageVisibilityState() const = 0; 126 virtual PageVisibilityState pageVisibilityState() const = 0;
(...skipping 14 matching lines...) Expand all
140 { 141 {
141 return new AutoplayExperimentHelper(client); 142 return new AutoplayExperimentHelper(client);
142 } 143 }
143 144
144 ~AutoplayExperimentHelper(); 145 ~AutoplayExperimentHelper();
145 146
146 void becameReadyToPlay(); 147 void becameReadyToPlay();
147 void playMethodCalled(); 148 void playMethodCalled();
148 void pauseMethodCalled(); 149 void pauseMethodCalled();
149 void loadMethodCalled(); 150 void loadMethodCalled();
151 void mutedChanged();
150 void positionChanged(const IntRect&); 152 void positionChanged(const IntRect&);
151 void updatePositionNotificationRegistration(); 153 void updatePositionNotificationRegistration();
152 void recordSandboxFailure(); 154 void recordSandboxFailure();
153 void loadingStarted(); 155 void loadingStarted();
154 void playbackStarted(); 156 void playbackStarted();
155 void playbackStopped(); 157 void playbackStopped();
156 void initialPlayWithUserGesture(); 158 void initialPlayWithUserGesture();
157 159
158 // Returns true if and only if any experiment is enabled (i.e., |m_mode| 160 // Returns true if and only if any experiment is enabled (i.e., |m_mode|
159 // is not ExperimentOff). 161 // is not ExperimentOff).
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // the viewport. 200 // the viewport.
199 IfPartialViewport = 1 << 4, 201 IfPartialViewport = 1 << 4,
200 // Restrict gestureless autoplay to audio-less or muted media. 202 // Restrict gestureless autoplay to audio-less or muted media.
201 IfMuted = 1 << 5, 203 IfMuted = 1 << 5,
202 // Restrict gestureless autoplay to sites which contain the 204 // Restrict gestureless autoplay to sites which contain the
203 // viewport tag. 205 // viewport tag.
204 IfMobile = 1 << 6, 206 IfMobile = 1 << 6,
205 // Restrict gestureless autoplay to sites which are from the same origin 207 // Restrict gestureless autoplay to sites which are from the same origin
206 // as the top-level frame. 208 // as the top-level frame.
207 IfSameOrigin = 1 << 7, 209 IfSameOrigin = 1 << 7,
210 // Extend IfSameOrigin to allow autoplay of cross-origin elements if
211 // they're muted. This has no effect on same-origin or if IfSameOrigin
212 // isn't enabled.
213 OrMuted = 1 << 8,
208 // If gestureless autoplay is allowed, then mute the media before 214 // If gestureless autoplay is allowed, then mute the media before
209 // starting to play. 215 // starting to play.
210 PlayMuted = 1 << 8, 216 PlayMuted = 1 << 9,
211 }; 217 };
212 218
213 DEFINE_INLINE_TRACE() { visitor->trace(m_client); } 219 DEFINE_INLINE_TRACE() { visitor->trace(m_client); }
214 220
215 private: 221 private:
216 explicit AutoplayExperimentHelper(Client*); 222 explicit AutoplayExperimentHelper(Client*);
217 223
218 // Register to receive position updates, if we haven't already. If we 224 // Register to receive position updates, if we haven't already. If we
219 // have, then this does nothing. 225 // have, then this does nothing.
220 void registerForPositionUpdatesIfNeeded(); 226 void registerForPositionUpdatesIfNeeded();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 inline AutoplayExperimentHelper::Mode& operator|=(AutoplayExperimentHelper::Mode & a, 346 inline AutoplayExperimentHelper::Mode& operator|=(AutoplayExperimentHelper::Mode & a,
341 const AutoplayExperimentHelper::Mode& b) 347 const AutoplayExperimentHelper::Mode& b)
342 { 348 {
343 a = static_cast<AutoplayExperimentHelper::Mode>(static_cast<int>(a) | static _cast<int>(b)); 349 a = static_cast<AutoplayExperimentHelper::Mode>(static_cast<int>(a) | static _cast<int>(b));
344 return a; 350 return a;
345 } 351 }
346 352
347 } // namespace blink 353 } // namespace blink
348 354
349 #endif // AutoplayExperimentHelper_h 355 #endif // AutoplayExperimentHelper_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698