| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 return !element_->paused() && muted && IsLockedPendingUserGesture(); | 205 return !element_->paused() && muted && IsLockedPendingUserGesture(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool AutoplayPolicy::IsLockedPendingUserGesture() const { | 208 bool AutoplayPolicy::IsLockedPendingUserGesture() const { |
| 209 return locked_pending_user_gesture_; | 209 return locked_pending_user_gesture_; |
| 210 } | 210 } |
| 211 | 211 |
| 212 void AutoplayPolicy::TryUnlockingUserGesture() { | 212 void AutoplayPolicy::TryUnlockingUserGesture() { |
| 213 if (IsLockedPendingUserGesture() && | 213 if (IsLockedPendingUserGesture() && |
| 214 UserGestureIndicator::UtilizeUserGesture()) { | 214 UserGestureIndicator::ProcessingUserGesture()) { |
| 215 UnlockUserGesture(); | 215 UnlockUserGesture(); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 void AutoplayPolicy::UnlockUserGesture() { | 219 void AutoplayPolicy::UnlockUserGesture() { |
| 220 locked_pending_user_gesture_ = false; | 220 locked_pending_user_gesture_ = false; |
| 221 locked_pending_user_gesture_if_cross_origin_experiment_enabled_ = false; | 221 locked_pending_user_gesture_if_cross_origin_experiment_enabled_ = false; |
| 222 } | 222 } |
| 223 | 223 |
| 224 bool AutoplayPolicy::IsGestureNeededForPlayback() const { | 224 bool AutoplayPolicy::IsGestureNeededForPlayback() const { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 return element_->can_autoplay_ && element_->paused_ && element_->Autoplay(); | 292 return element_->can_autoplay_ && element_->paused_ && element_->Autoplay(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 DEFINE_TRACE(AutoplayPolicy) { | 295 DEFINE_TRACE(AutoplayPolicy) { |
| 296 visitor->Trace(element_); | 296 visitor->Trace(element_); |
| 297 visitor->Trace(autoplay_visibility_observer_); | 297 visitor->Trace(autoplay_visibility_observer_); |
| 298 visitor->Trace(autoplay_uma_helper_); | 298 visitor->Trace(autoplay_uma_helper_); |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace blink | 301 } // namespace blink |
| OLD | NEW |