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 9156bba583b6c602b3a8cc84b4db479d0b50a85d..902affb71737a2f9f111e65cfe73cdca8c78eda1 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 |
}; |
@@ -357,6 +358,16 @@ 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(); |
+} |
+ |
HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, |
Document& document) |
: HTMLElement(tagName, document), |
@@ -2361,6 +2372,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); |