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

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: Addressed comment from fs Created 5 years, 6 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 aa41d278c8f73fc305c6fb6df818e5137559f8c7..6d4ab3a8acdd52d0988f429725a8f44d54d28df3 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -2502,6 +2502,10 @@ void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection()
if (m_closedCaptionsVisible)
configuration.forceEnableSubtitleOrCaptionTrack = true;
+ Settings* settings = document().settings();
+ if (settings)
+ configuration.textTrackKindUserPreference = settings->textTrackKindUserPreference();
+
AutomaticTrackSelection trackSelection(configuration);
trackSelection.perform(*m_textTracks);
@@ -3278,6 +3282,32 @@ void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible)
updateTextTrackDisplay();
}
+void HTMLMediaElement::setTextTrackKindUserPreferenceForAllMediaElements(Document* document)
+{
+ WeakMediaElementSet elements = documentToElementSetMap().get(document);
+ for (const auto& element: elements)
+ element->automaticTrackSelectionForUpdatedUserPreference();
+}
+
+void HTMLMediaElement::automaticTrackSelectionForUpdatedUserPreference()
+{
+ markCaptionAndSubtitleTracksAsUnconfigured();
+ m_processingPreferenceChange = true;
+ m_closedCaptionsVisible = false;
+ honorUserPreferencesForAutomaticTextTrackSelection();
+ m_processingPreferenceChange = false;
+
+ // If a track is set to showing post performing automatic track selection,
+ // set closed captions state to visible to update the CC button and display the track.
+ for (unsigned i = 0; i < m_textTracks->length(); ++i) {
fs 2015/06/23 09:23:58 We have this same loop in configureTextTrackDispla
srivats 2015/06/24 01:40:19 Done.
+ RefPtrWillBeRawPtr<TextTrack> textTrack = m_textTracks->item(i);
+ if (textTrack->mode() == TextTrack::showingKeyword())
+ m_closedCaptionsVisible = true;
+ }
+
+ updateTextTrackDisplay();
+}
+
void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured()
{
if (!m_textTracks)

Powered by Google App Engine
This is Rietveld 408576698