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

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: rebase 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 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);
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | third_party/WebKit/Source/core/html/shadow/MediaControls.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698