Chromium Code Reviews| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 | 67 |
| 68 // Record the source. | 68 // Record the source. |
| 69 if (m_element->isHTMLVideoElement()) { | 69 if (m_element->isHTMLVideoElement()) { |
| 70 videoHistogram.count(static_cast<int>(m_source)); | 70 videoHistogram.count(static_cast<int>(m_source)); |
| 71 if (m_element->muted()) | 71 if (m_element->muted()) |
| 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 the child frame and top-level frame URLs for autoplay muted videos | |
| 78 // by attribute. | |
| 79 if (m_elemnet->isHTMLVideoElement() && m_element->muted() && | |
| 80 source == AutoplaySource::Attribute) { | |
| 81 Platform::current()->recordRapporURL( | |
| 82 "Media.Video.Autoplay.Muted.Attribute.ChildFrame", | |
| 83 m_element->document().url()); | |
| 84 Platform::current()->recordRapporURL( | |
| 85 "Media.Video.Autoplay.Muted.Attribute.TopLevelFrame", | |
| 86 m_element->document().topDocument().url()); | |
|
mlamouri (slow - plz ping)
2017/02/20 11:23:43
FWIW, I'm not sure if that's the right thing to do
Zhiqiang Zhang (Slow)
2017/02/20 17:49:43
Maybe we just don't record the top-level frames at
| |
| 87 } | |
| 88 | |
| 77 // Record if it will be blocked by Data Saver or Autoplay setting. | 89 // Record if it will be blocked by Data Saver or Autoplay setting. |
| 78 if (m_element->isHTMLVideoElement() && m_element->muted() && | 90 if (m_element->isHTMLVideoElement() && m_element->muted() && |
| 79 RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) { | 91 RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) { |
| 80 bool dataSaverEnabled = | 92 bool dataSaverEnabled = |
| 81 m_element->document().settings() && | 93 m_element->document().settings() && |
| 82 m_element->document().settings()->getDataSaverEnabled(); | 94 m_element->document().settings()->getDataSaverEnabled(); |
| 83 bool blockedBySetting = !m_element->isAutoplayAllowedPerSettings(); | 95 bool blockedBySetting = !m_element->isAutoplayAllowedPerSettings(); |
| 84 | 96 |
| 85 if (dataSaverEnabled && blockedBySetting) { | 97 if (dataSaverEnabled && blockedBySetting) { |
| 86 blockedMutedVideoHistogram.count( | 98 blockedMutedVideoHistogram.count( |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 | 373 |
| 362 DEFINE_TRACE(AutoplayUmaHelper) { | 374 DEFINE_TRACE(AutoplayUmaHelper) { |
| 363 EventListener::trace(visitor); | 375 EventListener::trace(visitor); |
| 364 ContextLifecycleObserver::trace(visitor); | 376 ContextLifecycleObserver::trace(visitor); |
| 365 visitor->trace(m_element); | 377 visitor->trace(m_element); |
| 366 visitor->trace(m_mutedVideoPlayMethodVisibilityObserver); | 378 visitor->trace(m_mutedVideoPlayMethodVisibilityObserver); |
| 367 visitor->trace(m_mutedVideoOffscreenDurationVisibilityObserver); | 379 visitor->trace(m_mutedVideoOffscreenDurationVisibilityObserver); |
| 368 } | 380 } |
| 369 | 381 |
| 370 } // namespace blink | 382 } // namespace blink |
| OLD | NEW |