Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp

Issue 2706593002: [Blink>Media] Adding rappor metrics to record autoplay muted by attribute usage (Closed)
Patch Set: record separately Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/rappor/rappor.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_element->isHTMLVideoElement() && m_element->muted()) {
80 if (source == AutoplaySource::Attribute) {
81 Platform::current()->recordRapporURL(
82 "Media.Video.Autoplay.Muted.Attribute.Frame",
83 m_element->document().url());
84 } else {
85 DCHECK(source == AutoplaySource::Method);
86 Platform::current()->recordRapporURL(
87 "Media.Video.Autoplay.Muted.PlayMethod.Frame",
88 m_element->document().url());
89 }
90 }
91
77 // Record if it will be blocked by Data Saver or Autoplay setting. 92 // Record if it will be blocked by Data Saver or Autoplay setting.
78 if (m_element->isHTMLVideoElement() && m_element->muted() && 93 if (m_element->isHTMLVideoElement() && m_element->muted() &&
79 RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) { 94 RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) {
80 bool dataSaverEnabled = 95 bool dataSaverEnabled =
81 m_element->document().settings() && 96 m_element->document().settings() &&
82 m_element->document().settings()->getDataSaverEnabled(); 97 m_element->document().settings()->getDataSaverEnabled();
83 bool blockedBySetting = !m_element->isAutoplayAllowedPerSettings(); 98 bool blockedBySetting = !m_element->isAutoplayAllowedPerSettings();
84 99
85 if (dataSaverEnabled && blockedBySetting) { 100 if (dataSaverEnabled && blockedBySetting) {
86 blockedMutedVideoHistogram.count( 101 blockedMutedVideoHistogram.count(
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 376
362 DEFINE_TRACE(AutoplayUmaHelper) { 377 DEFINE_TRACE(AutoplayUmaHelper) {
363 EventListener::trace(visitor); 378 EventListener::trace(visitor);
364 ContextLifecycleObserver::trace(visitor); 379 ContextLifecycleObserver::trace(visitor);
365 visitor->trace(m_element); 380 visitor->trace(m_element);
366 visitor->trace(m_mutedVideoPlayMethodVisibilityObserver); 381 visitor->trace(m_mutedVideoPlayMethodVisibilityObserver);
367 visitor->trace(m_mutedVideoOffscreenDurationVisibilityObserver); 382 visitor->trace(m_mutedVideoOffscreenDurationVisibilityObserver);
368 } 383 }
369 384
370 } // namespace blink 385 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/rappor/rappor.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698