| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 return false; | 294 return false; |
| 295 return frame->GetContentSettingsClient()->AllowAutoplay(true); | 295 return frame->GetContentSettingsClient()->AllowAutoplay(true); |
| 296 } | 296 } |
| 297 | 297 |
| 298 bool AutoplayPolicy::ShouldAutoplay() { | 298 bool AutoplayPolicy::ShouldAutoplay() { |
| 299 if (element_->GetDocument().IsSandboxed(kSandboxAutomaticFeatures)) | 299 if (element_->GetDocument().IsSandboxed(kSandboxAutomaticFeatures)) |
| 300 return false; | 300 return false; |
| 301 return element_->can_autoplay_ && element_->paused_ && element_->Autoplay(); | 301 return element_->can_autoplay_ && element_->paused_ && element_->Autoplay(); |
| 302 } | 302 } |
| 303 | 303 |
| 304 void AutoplayPolicy::OnLoadStarted(WebMediaPlayer::LoadType load_type) { |
| 305 autoplay_uma_helper_->OnLoadStarted(load_type); |
| 306 } |
| 307 |
| 304 DEFINE_TRACE(AutoplayPolicy) { | 308 DEFINE_TRACE(AutoplayPolicy) { |
| 305 visitor->Trace(element_); | 309 visitor->Trace(element_); |
| 306 visitor->Trace(autoplay_visibility_observer_); | 310 visitor->Trace(autoplay_visibility_observer_); |
| 307 visitor->Trace(autoplay_uma_helper_); | 311 visitor->Trace(autoplay_uma_helper_); |
| 308 } | 312 } |
| 309 | 313 |
| 310 } // namespace blink | 314 } // namespace blink |
| OLD | NEW |