OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "core/html/media/AutoplayPolicy.h" | 5 #include "core/html/media/AutoplayPolicy.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/ElementVisibilityObserver.h" | 8 #include "core/dom/ElementVisibilityObserver.h" |
9 #include "core/frame/ContentSettingsClient.h" | 9 #include "core/frame/ContentSettingsClient.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 return false; | 285 return false; |
286 return frame->GetContentSettingsClient()->AllowAutoplay(true); | 286 return frame->GetContentSettingsClient()->AllowAutoplay(true); |
287 } | 287 } |
288 | 288 |
289 bool AutoplayPolicy::ShouldAutoplay() { | 289 bool AutoplayPolicy::ShouldAutoplay() { |
290 if (element_->GetDocument().IsSandboxed(kSandboxAutomaticFeatures)) | 290 if (element_->GetDocument().IsSandboxed(kSandboxAutomaticFeatures)) |
291 return false; | 291 return false; |
292 return element_->can_autoplay_ && element_->paused_ && element_->Autoplay(); | 292 return element_->can_autoplay_ && element_->paused_ && element_->Autoplay(); |
293 } | 293 } |
294 | 294 |
| 295 void AutoplayPolicy::OnLoadStarted() { |
| 296 autoplay_uma_helper_->OnLoadStarted(); |
| 297 } |
| 298 |
295 DEFINE_TRACE(AutoplayPolicy) { | 299 DEFINE_TRACE(AutoplayPolicy) { |
296 visitor->Trace(element_); | 300 visitor->Trace(element_); |
297 visitor->Trace(autoplay_visibility_observer_); | 301 visitor->Trace(autoplay_visibility_observer_); |
298 visitor->Trace(autoplay_uma_helper_); | 302 visitor->Trace(autoplay_uma_helper_); |
299 } | 303 } |
300 | 304 |
301 } // namespace blink | 305 } // namespace blink |
OLD | NEW |