Chromium Code Reviews| 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 |