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

Side by Side Diff: Source/core/html/HTMLMediaElement.h

Issue 868113005: Move automatic text track selection code to AutomaticTrackSelection helper (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Pass TextTrackList as parameter instead. Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 blink::WebMediaPlayer::TrackId addAudioTrack(const String& id, blink::WebMed iaPlayerClient::AudioTrackKind, const AtomicString& label, const AtomicString& l anguage, bool enabled); 194 blink::WebMediaPlayer::TrackId addAudioTrack(const String& id, blink::WebMed iaPlayerClient::AudioTrackKind, const AtomicString& label, const AtomicString& l anguage, bool enabled);
195 void removeAudioTrack(blink::WebMediaPlayer::TrackId); 195 void removeAudioTrack(blink::WebMediaPlayer::TrackId);
196 blink::WebMediaPlayer::TrackId addVideoTrack(const String& id, blink::WebMed iaPlayerClient::VideoTrackKind, const AtomicString& label, const AtomicString& l anguage, bool selected); 196 blink::WebMediaPlayer::TrackId addVideoTrack(const String& id, blink::WebMed iaPlayerClient::VideoTrackKind, const AtomicString& label, const AtomicString& l anguage, bool selected);
197 void removeVideoTrack(blink::WebMediaPlayer::TrackId); 197 void removeVideoTrack(blink::WebMediaPlayer::TrackId);
198 198
199 virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) override final; 199 virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) override final;
200 virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) overr ide final; 200 virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) overr ide final;
201 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d epend on it. 201 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d epend on it.
202 virtual KURL mediaPlayerPosterURL() override { return KURL(); } 202 virtual KURL mediaPlayerPosterURL() override { return KURL(); }
203 203
204 class TrackGroup {
205 STACK_ALLOCATED();
206 public:
207 enum GroupKind { CaptionsAndSubtitles, Description, Chapter, Metadata, O ther };
208
209 explicit TrackGroup(GroupKind kind)
210 : visibleTrack(nullptr)
211 , defaultTrack(nullptr)
212 , kind(kind)
213 , hasSrcLang(false)
214 {
215 }
216
217 WillBeHeapVector<RefPtrWillBeMember<TextTrack>> tracks;
218 RefPtrWillBeMember<TextTrack> visibleTrack;
219 RefPtrWillBeMember<TextTrack> defaultTrack;
220 GroupKind kind;
221 bool hasSrcLang;
222 };
223
224 void configureTextTrackGroupForLanguage(const TrackGroup&) const;
225 void honorUserPreferencesForAutomaticTextTrackSelection(); 204 void honorUserPreferencesForAutomaticTextTrackSelection();
226 void performAutomaticTextTrackSelection(const TrackGroup&);
227 void enableDefaultMetadataTextTracks(const TrackGroup&);
228 205
229 bool textTracksAreReady() const; 206 bool textTracksAreReady() const;
230 enum VisibilityChangeAssumption { 207 enum VisibilityChangeAssumption {
231 AssumeNoVisibleChange, 208 AssumeNoVisibleChange,
232 AssumeVisibleChange 209 AssumeVisibleChange
233 }; 210 };
234 void configureTextTrackDisplay(VisibilityChangeAssumption); 211 void configureTextTrackDisplay(VisibilityChangeAssumption);
235 void updateTextTrackDisplay(); 212 void updateTextTrackDisplay();
236 void textTrackReadyStateChanged(TextTrack*); 213 void textTrackReadyStateChanged(TextTrack*);
237 214
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 inline bool isHTMLMediaElement(const HTMLElement& element) 611 inline bool isHTMLMediaElement(const HTMLElement& element)
635 { 612 {
636 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 613 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
637 } 614 }
638 615
639 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 616 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
640 617
641 } // namespace blink 618 } // namespace blink
642 619
643 #endif // HTMLMediaElement_h 620 #endif // HTMLMediaElement_h
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698