OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/html/track/AutomaticTrackSelection.h" | 6 #include "core/html/track/AutomaticTrackSelection.h" |
7 | 7 |
8 #include "core/html/track/TextTrack.h" | 8 #include "core/html/track/TextTrack.h" |
9 #include "core/html/track/TextTrackList.h" | 9 #include "core/html/track/TextTrackList.h" |
10 #include "platform/Language.h" | 10 #include "platform/Language.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 161 } |
162 | 162 |
163 void AutomaticTrackSelection::perform(TextTrackList& textTracks) | 163 void AutomaticTrackSelection::perform(TextTrackList& textTracks) |
164 { | 164 { |
165 TrackGroup captionAndSubtitleTracks(TrackGroup::CaptionsAndSubtitles); | 165 TrackGroup captionAndSubtitleTracks(TrackGroup::CaptionsAndSubtitles); |
166 TrackGroup descriptionTracks(TrackGroup::Description); | 166 TrackGroup descriptionTracks(TrackGroup::Description); |
167 TrackGroup chapterTracks(TrackGroup::Chapter); | 167 TrackGroup chapterTracks(TrackGroup::Chapter); |
168 TrackGroup metadataTracks(TrackGroup::Metadata); | 168 TrackGroup metadataTracks(TrackGroup::Metadata); |
169 | 169 |
170 for (size_t i = 0; i < textTracks.length(); ++i) { | 170 for (size_t i = 0; i < textTracks.length(); ++i) { |
171 TextTrack* textTrack = textTracks.item(i); | 171 TextTrack* textTrack = textTracks.anonymousIndexedGetter(i); |
172 if (!textTrack) | 172 if (!textTrack) |
173 continue; | 173 continue; |
174 | 174 |
175 String kind = textTrack->kind(); | 175 String kind = textTrack->kind(); |
176 TrackGroup* currentGroup; | 176 TrackGroup* currentGroup; |
177 if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captions
Keyword()) { | 177 if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captions
Keyword()) { |
178 currentGroup = &captionAndSubtitleTracks; | 178 currentGroup = &captionAndSubtitleTracks; |
179 } else if (kind == TextTrack::descriptionsKeyword()) { | 179 } else if (kind == TextTrack::descriptionsKeyword()) { |
180 currentGroup = &descriptionTracks; | 180 currentGroup = &descriptionTracks; |
181 } else if (kind == TextTrack::chaptersKeyword()) { | 181 } else if (kind == TextTrack::chaptersKeyword()) { |
(...skipping 26 matching lines...) Expand all Loading... |
208 performAutomaticTextTrackSelection(captionAndSubtitleTracks); | 208 performAutomaticTextTrackSelection(captionAndSubtitleTracks); |
209 if (descriptionTracks.tracks.size()) | 209 if (descriptionTracks.tracks.size()) |
210 performAutomaticTextTrackSelection(descriptionTracks); | 210 performAutomaticTextTrackSelection(descriptionTracks); |
211 if (chapterTracks.tracks.size()) | 211 if (chapterTracks.tracks.size()) |
212 performAutomaticTextTrackSelection(chapterTracks); | 212 performAutomaticTextTrackSelection(chapterTracks); |
213 if (metadataTracks.tracks.size()) | 213 if (metadataTracks.tracks.size()) |
214 enableDefaultMetadataTextTracks(metadataTracks); | 214 enableDefaultMetadataTextTracks(metadataTracks); |
215 } | 215 } |
216 | 216 |
217 } // namespace blink | 217 } // namespace blink |
OLD | NEW |