| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/AutoplayUmaHelper.h" | 5 #include "core/html/AutoplayUmaHelper.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/events/Event.h" | 9 #include "core/events/Event.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 mutedVideoHistogram.count(static_cast<int>(m_source)); | 72 mutedVideoHistogram.count(static_cast<int>(m_source)); |
| 73 } else { | 73 } else { |
| 74 audioHistogram.count(static_cast<int>(m_source)); | 74 audioHistogram.count(static_cast<int>(m_source)); |
| 75 } | 75 } |
| 76 | 76 |
| 77 // Record if it will be blocked by Data Saver or Autoplay setting. | 77 // Record if it will be blocked by Data Saver or Autoplay setting. |
| 78 if (m_element->isHTMLVideoElement() && m_element->muted() && | 78 if (m_element->isHTMLVideoElement() && m_element->muted() && |
| 79 RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) { | 79 RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) { |
| 80 bool dataSaverEnabled = | 80 bool dataSaverEnabled = |
| 81 m_element->document().settings() && | 81 m_element->document().settings() && |
| 82 m_element->document().settings()->dataSaverEnabled(); | 82 m_element->document().settings()->getDataSaverEnabled(); |
| 83 bool blockedBySetting = !m_element->isAutoplayAllowedPerSettings(); | 83 bool blockedBySetting = !m_element->isAutoplayAllowedPerSettings(); |
| 84 | 84 |
| 85 if (dataSaverEnabled && blockedBySetting) { | 85 if (dataSaverEnabled && blockedBySetting) { |
| 86 blockedMutedVideoHistogram.count( | 86 blockedMutedVideoHistogram.count( |
| 87 AutoplayBlockedReasonDataSaverAndSetting); | 87 AutoplayBlockedReasonDataSaverAndSetting); |
| 88 } else if (dataSaverEnabled) { | 88 } else if (dataSaverEnabled) { |
| 89 blockedMutedVideoHistogram.count(AutoplayBlockedReasonDataSaver); | 89 blockedMutedVideoHistogram.count(AutoplayBlockedReasonDataSaver); |
| 90 } else if (blockedBySetting) { | 90 } else if (blockedBySetting) { |
| 91 blockedMutedVideoHistogram.count(AutoplayBlockedReasonSetting); | 91 blockedMutedVideoHistogram.count(AutoplayBlockedReasonSetting); |
| 92 } | 92 } |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 361 |
| 362 DEFINE_TRACE(AutoplayUmaHelper) { | 362 DEFINE_TRACE(AutoplayUmaHelper) { |
| 363 EventListener::trace(visitor); | 363 EventListener::trace(visitor); |
| 364 ContextLifecycleObserver::trace(visitor); | 364 ContextLifecycleObserver::trace(visitor); |
| 365 visitor->trace(m_element); | 365 visitor->trace(m_element); |
| 366 visitor->trace(m_mutedVideoPlayMethodVisibilityObserver); | 366 visitor->trace(m_mutedVideoPlayMethodVisibilityObserver); |
| 367 visitor->trace(m_mutedVideoOffscreenDurationVisibilityObserver); | 367 visitor->trace(m_mutedVideoOffscreenDurationVisibilityObserver); |
| 368 } | 368 } |
| 369 | 369 |
| 370 } // namespace blink | 370 } // namespace blink |
| OLD | NEW |