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 dbbcdb2a5f44f36eca2d3e73a0eb1f310c6f99f7..a3a195c2fcc3b2a7ca372c8415f8bea99985f949 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
@@ -134,6 +134,7 @@ enum MediaControlsShow { |
MediaControlsShowFullscreen, |
MediaControlsShowNoScript, |
MediaControlsShowNotShown, |
+ MediaControlsShowDisabledSettings, |
MediaControlsShowMax |
}; |
@@ -372,6 +373,18 @@ bool HTMLMediaElement::mediaTracksEnabledInternally() { |
RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled(); |
} |
+void HTMLMediaElement::onMediaControlsEnabledChange(Document* document) { |
+ auto it = documentToElementSetMap().find(document); |
+ if (it == documentToElementSetMap().end()) |
+ return; |
+ DCHECK(it->value); |
+ WeakMediaElementSet& elements = *it->value; |
+ for (const auto& element : elements) { |
+ element->updateControlsVisibility(); |
+ element->mediaControls()->onMediaControlsEnabledChange(); |
+ } |
+} |
+ |
HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, |
Document& document) |
: HTMLElement(tagName, document), |
@@ -2386,6 +2399,13 @@ void HTMLMediaElement::setLoop(bool b) { |
bool HTMLMediaElement::shouldShowControls( |
const RecordMetricsBehavior recordMetrics) const { |
+ Settings* settings = document().settings(); |
+ if (settings && !settings->getMediaControlsEnabled()) { |
+ if (recordMetrics == RecordMetricsBehavior::DoRecord) |
+ showControlsHistogram().count(MediaControlsShowDisabledSettings); |
+ return false; |
+ } |
+ |
if (fastHasAttribute(controlsAttr)) { |
if (recordMetrics == RecordMetricsBehavior::DoRecord) |
showControlsHistogram().count(MediaControlsShowAttribute); |