| OLD | NEW |
| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 virtual void removeUserGestureRequirement() = 0; | 116 virtual void removeUserGestureRequirement() = 0; |
| 117 virtual void recordAutoplayMetric(AutoplayMetrics) = 0; | 117 virtual void recordAutoplayMetric(AutoplayMetrics) = 0; |
| 118 virtual bool shouldAutoplay() = 0; | 118 virtual bool shouldAutoplay() = 0; |
| 119 virtual bool isHTMLVideoElement() const = 0; | 119 virtual bool isHTMLVideoElement() const = 0; |
| 120 virtual bool isHTMLAudioElement() const = 0; | 120 virtual bool isHTMLAudioElement() const = 0; |
| 121 | 121 |
| 122 // Document | 122 // Document |
| 123 virtual bool isLegacyViewportType() = 0; | 123 virtual bool isLegacyViewportType() = 0; |
| 124 virtual PageVisibilityState pageVisibilityState() const = 0; | 124 virtual PageVisibilityState pageVisibilityState() const = 0; |
| 125 virtual String autoplayExperimentMode() const = 0; | 125 virtual String autoplayExperimentMode() const = 0; |
| 126 virtual LocalFrame* frame() const = 0; |
| 126 | 127 |
| 127 // LayoutObject | 128 // LayoutObject |
| 128 virtual void setRequestPositionUpdates(bool) = 0; | 129 virtual void setRequestPositionUpdates(bool) = 0; |
| 129 virtual IntRect absoluteBoundingBoxRect() const = 0; | 130 virtual IntRect absoluteBoundingBoxRect() const = 0; |
| 130 | 131 |
| 131 DEFINE_INLINE_VIRTUAL_TRACE() { } | 132 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 static AutoplayExperimentHelper* create(Client* client) | 135 static AutoplayExperimentHelper* create(Client* client) |
| 135 { | 136 { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // Restrict gestureless autoplay to media that is entirely visible in | 175 // Restrict gestureless autoplay to media that is entirely visible in |
| 175 // the viewport. | 176 // the viewport. |
| 176 IfViewport = 1 << 3, | 177 IfViewport = 1 << 3, |
| 177 // Restrict gestureless autoplay to media that is partially visible in | 178 // Restrict gestureless autoplay to media that is partially visible in |
| 178 // the viewport. | 179 // the viewport. |
| 179 IfPartialViewport = 1 << 4, | 180 IfPartialViewport = 1 << 4, |
| 180 // Restrict gestureless autoplay to audio-less or muted media. | 181 // Restrict gestureless autoplay to audio-less or muted media. |
| 181 IfMuted = 1 << 5, | 182 IfMuted = 1 << 5, |
| 182 // Restrict gestureless autoplay to sites which contain the | 183 // Restrict gestureless autoplay to sites which contain the |
| 183 // viewport tag. | 184 // viewport tag. |
| 184 IfMobile = 1 << 6, | 185 IfMobile = 1 << 5, |
| 186 // Restrict gestureless autoplay to sites which are from the same origin |
| 187 // as the top-level frame. |
| 188 IfSameOrigin = 1 << 6, |
| 189 // When combined with IfSameOrigin, allow muted to override the same |
| 190 // origin check. Else, this does nothing. |
| 191 OrMuted = 1 << 7, |
| 185 // If gestureless autoplay is allowed, then mute the media before | 192 // If gestureless autoplay is allowed, then mute the media before |
| 186 // starting to play. | 193 // starting to play. |
| 187 PlayMuted = 1 << 7, | 194 PlayMuted = 1 << 8, |
| 188 }; | 195 }; |
| 189 | 196 |
| 190 DEFINE_INLINE_TRACE() { visitor->trace(m_client); } | 197 DEFINE_INLINE_TRACE() { visitor->trace(m_client); } |
| 191 | 198 |
| 192 private: | 199 private: |
| 193 explicit AutoplayExperimentHelper(Client*); | 200 explicit AutoplayExperimentHelper(Client*); |
| 194 | 201 |
| 195 // Register to receive position updates, if we haven't already. If we | 202 // Register to receive position updates, if we haven't already. If we |
| 196 // have, then this does nothing. | 203 // have, then this does nothing. |
| 197 void registerForPositionUpdatesIfNeeded(); | 204 void registerForPositionUpdatesIfNeeded(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 inline AutoplayExperimentHelper::Mode& operator|=(AutoplayExperimentHelper::Mode
& a, | 312 inline AutoplayExperimentHelper::Mode& operator|=(AutoplayExperimentHelper::Mode
& a, |
| 306 const AutoplayExperimentHelper::Mode& b) | 313 const AutoplayExperimentHelper::Mode& b) |
| 307 { | 314 { |
| 308 a = static_cast<AutoplayExperimentHelper::Mode>(static_cast<int>(a) | static
_cast<int>(b)); | 315 a = static_cast<AutoplayExperimentHelper::Mode>(static_cast<int>(a) | static
_cast<int>(b)); |
| 309 return a; | 316 return a; |
| 310 } | 317 } |
| 311 | 318 |
| 312 } // namespace blink | 319 } // namespace blink |
| 313 | 320 |
| 314 #endif // AutoplayExperimentHelper_h | 321 #endif // AutoplayExperimentHelper_h |
| OLD | NEW |