Chromium Code Reviews| 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) |