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

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 1700743003: Record whether and why the media default controls are being shown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media-controls-usecount
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index 0599ce2187e9d5ee7a4d68778485fd4a11fc5540..d93ac3aa197a78ed4255f2c6c97d2517fb3126b1 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -89,6 +89,18 @@
namespace blink {
+namespace {
+
+enum DefaultControlsShow {
philipj_slow 2016/02/16 06:20:27 I'd call it MediaControls, because these are the o
mlamouri (slow - plz ping) 2016/02/18 15:49:31 Done.
+ DefaultControlsShowAttribute = 0,
+ DefaultControlsShowFullscreen,
+ DefaultControlsShowNoScript,
+ DefaultControlsShowNone,
+ DefaultControlsShowMax
+};
+
+} // anonymous namespace
philipj_slow 2016/02/16 06:20:27 Move the below static things into the anonymous na
mlamouri (slow - plz ping) 2016/02/18 15:49:31 I did that here: https://codereview.chromium.org/1
+
#if !LOG_DISABLED
static String urlForLoggingMedia(const KURL& url)
{
@@ -2091,6 +2103,30 @@ bool HTMLMediaElement::shouldShowControls() const
return fastHasAttribute(controlsAttr);
}
+void HTMLMediaElement::recordShowControls() const
+{
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, showControlsHistogram, ("Media.Controls.Show", DefaultControlsShowMax));
+
+ if (fastHasAttribute(controlsAttr)) {
philipj_slow 2016/02/16 06:20:27 Duplicating the conditions of shouldShowControls()
mlamouri (slow - plz ping) 2016/02/18 15:49:31 Fixed. I know have an internal show controls that
+ showControlsHistogram.count(DefaultControlsShowAttribute);
+ return;
+ }
+
+ if (isFullscreen()) {
+ showControlsHistogram.count(DefaultControlsShowFullscreen);
+ return;
+ }
+
+ LocalFrame* frame = document().frame();
+ if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript)) {
+ showControlsHistogram.count(DefaultControlsShowNoScript);
+ return;
+ }
+
+ ASSERT(!shouldShowControls());
+ showControlsHistogram.count(DefaultControlsShowNone);
+}
+
double HTMLMediaElement::volume() const
{
return m_volume;
@@ -3343,6 +3379,8 @@ void HTMLMediaElement::configureMediaControls()
ensureMediaControls();
mediaControls()->reset();
+
+ recordShowControls();
if (shouldShowControls())
mediaControls()->show();
else

Powered by Google App Engine
This is Rietveld 408576698