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

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

Issue 1118613002: Hook up Android closed captions 'enabled' setting to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 5558692f2650d0baa1f5ee8941d302f798161f0d..61bf3b111bd6d4a29ce44ec4131243ce3784476f 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -375,6 +375,13 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
setHasCustomStyleCallbacks();
addElementToDocumentMap(this, &document);
+ document.registerForTextTracksVisibilityChangedCallback(this);
+#if OS(ANDROID)
tkent 2015/04/29 23:58:44 Can you set the default value of textTracksEnabled
srivats 2015/05/01 23:03:31 Doing that will have closed captions turned on by
+ // The OS setting for closed captions state is only available on Android, iOS
+ // and OSX. Set closed captions visibility based on OS text tracks state only if the platform
+ // is Android because the setting is currently only plumbed down on Android.
+ setClosedCaptionsVisible(document.settings()->textTracksEnabled());
tkent 2015/04/29 23:58:44 document.settings() can be NULL.
srivats 2015/05/01 23:03:31 Done.
+#endif
}
HTMLMediaElement::~HTMLMediaElement()
@@ -413,6 +420,8 @@ HTMLMediaElement::~HTMLMediaElement()
}
#endif
+ document().unregisterFromTextTracksVisibilityChangedCallback(this);
+
#if ENABLE(OILPAN)
if (m_closeMediaSourceWhenFinalizing)
closeMediaSource();
@@ -3397,7 +3406,13 @@ void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu
return;
}
m_haveVisibleTextTrack = haveVisibleTextTrack;
+#if !OS(ANDROID)
m_closedCaptionsVisible = m_haveVisibleTextTrack;
+#else
+ // Set closed captions visible during initial load only if the video has a
+ // visible text track and when the android platform closed captions are enabled.
+ m_closedCaptionsVisible = m_haveVisibleTextTrack && document().settings()->textTracksEnabled();
+#endif
if (!m_haveVisibleTextTrack && !mediaControls())
return;

Powered by Google App Engine
This is Rietveld 408576698