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

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

Issue 2692903002: Don't show media controls when there is a persistent video. (Closed)
Patch Set: cleanup and tests 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 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 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);

Powered by Google App Engine
This is Rietveld 408576698