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