OLD | NEW |
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 double volume() const; | 156 double volume() const; |
157 void setVolume(double, ExceptionState&); | 157 void setVolume(double, ExceptionState&); |
158 bool muted() const; | 158 bool muted() const; |
159 void setMuted(bool); | 159 void setMuted(bool); |
160 | 160 |
161 // play/pause toggling that uses the media controller if present. togglePlay
StateWillPlay() is | 161 // play/pause toggling that uses the media controller if present. togglePlay
StateWillPlay() is |
162 // true if togglePlayState() will call play() or unpause() on the media elem
ent or controller. | 162 // true if togglePlayState() will call play() or unpause() on the media elem
ent or controller. |
163 bool togglePlayStateWillPlay() const; | 163 bool togglePlayStateWillPlay() const; |
164 void togglePlayState(); | 164 void togglePlayState(); |
165 | 165 |
166 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, const AtomicStr
ing& label, const AtomicString& language, ExceptionState&); | 166 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con
st AtomicString& label, const AtomicString& language, ExceptionState&); |
167 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, const AtomicStr
ing& label, ExceptionState& exceptionState) { return addTextTrack(kind, label, e
mptyAtom, exceptionState); } | 167 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con
st AtomicString& label, ExceptionState& exceptionState) { return addTextTrack(ki
nd, label, emptyAtom, exceptionState); } |
168 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, ExceptionState&
exceptionState) { return addTextTrack(kind, emptyAtom, emptyAtom, exceptionStat
e); } | 168 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, Exc
eptionState& exceptionState) { return addTextTrack(kind, emptyAtom, emptyAtom, e
xceptionState); } |
169 | 169 |
170 TextTrackList* textTracks(); | 170 TextTrackList* textTracks(); |
171 CueList currentlyActiveCues() const { return m_currentlyActiveCues; } | 171 CueList currentlyActiveCues() const { return m_currentlyActiveCues; } |
172 | 172 |
173 void addTextTrack(TextTrack*); | 173 void addTextTrack(TextTrack*); |
174 void removeTextTrack(TextTrack*); | 174 void removeTextTrack(TextTrack*); |
175 void closeCaptionTracksChanged(); | 175 void closeCaptionTracksChanged(); |
176 void notifyMediaPlayerOfTextTrackChanges(); | 176 void notifyMediaPlayerOfTextTrackChanges(); |
177 | 177 |
178 // Implements the "forget the media element's media-resource-specific tracks
" algorithm in the HTML5 spec. | 178 // Implements the "forget the media element's media-resource-specific tracks
" algorithm in the HTML5 spec. |
179 void forgetResourceSpecificTracks(); | 179 void forgetResourceSpecificTracks(); |
180 | 180 |
181 void didAddTrackElement(HTMLTrackElement*); | 181 void didAddTrackElement(HTMLTrackElement*); |
182 void didRemoveTrackElement(HTMLTrackElement*); | 182 void didRemoveTrackElement(HTMLTrackElement*); |
183 | 183 |
184 virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) OVERRIDE
FINAL; | 184 virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) OVERRIDE
FINAL; |
185 virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) OVERR
IDE FINAL; | 185 virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) OVERR
IDE FINAL; |
186 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d
epend on it. | 186 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d
epend on it. |
187 virtual KURL mediaPlayerPosterURL() OVERRIDE { return KURL(); } | 187 virtual KURL mediaPlayerPosterURL() OVERRIDE { return KURL(); } |
188 | 188 |
189 struct TrackGroup { | 189 class TrackGroup { |
| 190 STACK_ALLOCATED(); |
| 191 public: |
190 enum GroupKind { CaptionsAndSubtitles, Description, Chapter, Metadata, O
ther }; | 192 enum GroupKind { CaptionsAndSubtitles, Description, Chapter, Metadata, O
ther }; |
191 | 193 |
192 TrackGroup(GroupKind kind) | 194 explicit TrackGroup(GroupKind kind) |
193 : visibleTrack(nullptr) | 195 : visibleTrack(nullptr) |
194 , defaultTrack(nullptr) | 196 , defaultTrack(nullptr) |
195 , kind(kind) | 197 , kind(kind) |
196 , hasSrcLang(false) | 198 , hasSrcLang(false) |
197 { | 199 { |
198 } | 200 } |
199 | 201 |
200 Vector<RefPtr<TextTrack> > tracks; | 202 WillBeHeapVector<RefPtrWillBeMember<TextTrack> > tracks; |
201 RefPtr<TextTrack> visibleTrack; | 203 RefPtrWillBeMember<TextTrack> visibleTrack; |
202 RefPtr<TextTrack> defaultTrack; | 204 RefPtrWillBeMember<TextTrack> defaultTrack; |
203 GroupKind kind; | 205 GroupKind kind; |
204 bool hasSrcLang; | 206 bool hasSrcLang; |
205 }; | 207 }; |
206 | 208 |
207 void configureTextTrackGroupForLanguage(const TrackGroup&) const; | 209 void configureTextTrackGroupForLanguage(const TrackGroup&) const; |
208 void configureTextTracks(); | 210 void configureTextTracks(); |
209 void configureTextTrackGroup(const TrackGroup&); | 211 void configureTextTrackGroup(const TrackGroup&); |
210 | 212 |
211 bool textTracksAreReady() const; | 213 bool textTracksAreReady() const; |
212 enum VisibilityChangeAssumption { | 214 enum VisibilityChangeAssumption { |
213 AssumeNoVisibleChange, | 215 AssumeNoVisibleChange, |
214 AssumeVisibleChange | 216 AssumeVisibleChange |
215 }; | 217 }; |
216 void configureTextTrackDisplay(VisibilityChangeAssumption); | 218 void configureTextTrackDisplay(VisibilityChangeAssumption); |
217 void updateTextTrackDisplay(); | 219 void updateTextTrackDisplay(); |
218 void textTrackReadyStateChanged(TextTrack*); | 220 void textTrackReadyStateChanged(TextTrack*); |
219 | 221 |
220 void textTrackKindChanged(TextTrack*); | 222 void textTrackKindChanged(TextTrack*); |
221 void textTrackModeChanged(TextTrack*); | 223 void textTrackModeChanged(TextTrack*); |
222 void textTrackAddCues(TextTrack*, const TextTrackCueList*); | 224 void textTrackAddCues(TextTrack*, const TextTrackCueList*); |
223 void textTrackRemoveCues(TextTrack*, const TextTrackCueList*); | 225 void textTrackRemoveCues(TextTrack*, const TextTrackCueList*); |
224 void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>); | 226 void textTrackAddCue(TextTrack*, PassRefPtrWillBeRawPtr<TextTrackCue>); |
225 void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>); | 227 void textTrackRemoveCue(TextTrack*, PassRefPtrWillBeRawPtr<TextTrackCue>); |
226 | 228 |
227 // EventTarget function. | 229 // EventTarget function. |
228 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which | 230 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which |
229 // causes an ambiguity error at compile time. This class's constructor | 231 // causes an ambiguity error at compile time. This class's constructor |
230 // ensures that both implementations return document, so return the result | 232 // ensures that both implementations return document, so return the result |
231 // of one of them here. | 233 // of one of them here. |
232 virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return H
TMLElement::executionContext(); } | 234 virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return H
TMLElement::executionContext(); } |
233 | 235 |
234 bool hasSingleSecurityOrigin() const { return !m_player || m_player->hasSing
leSecurityOrigin(); } | 236 bool hasSingleSecurityOrigin() const { return !m_player || m_player->hasSing
leSecurityOrigin(); } |
235 | 237 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 497 |
496 bool m_completelyLoaded : 1; | 498 bool m_completelyLoaded : 1; |
497 bool m_havePreparedToPlay : 1; | 499 bool m_havePreparedToPlay : 1; |
498 bool m_delayingLoadForPreloadNone : 1; | 500 bool m_delayingLoadForPreloadNone : 1; |
499 | 501 |
500 bool m_tracksAreReady : 1; | 502 bool m_tracksAreReady : 1; |
501 bool m_haveVisibleTextTrack : 1; | 503 bool m_haveVisibleTextTrack : 1; |
502 bool m_processingPreferenceChange : 1; | 504 bool m_processingPreferenceChange : 1; |
503 double m_lastTextTrackUpdateTime; | 505 double m_lastTextTrackUpdateTime; |
504 | 506 |
505 RefPtr<TextTrackList> m_textTracks; | 507 RefPtrWillBePersistent<TextTrackList> m_textTracks; |
506 Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan; | 508 WillBePersistentHeapVector<RefPtrWillBeMember<TextTrack> > m_textTracksWhenR
esourceSelectionBegan; |
507 | 509 |
508 CueIntervalTree m_cueTree; | 510 CueIntervalTree m_cueTree; |
509 | 511 |
510 CueList m_currentlyActiveCues; | 512 CueList m_currentlyActiveCues; |
511 int m_ignoreTrackDisplayUpdate; | 513 int m_ignoreTrackDisplayUpdate; |
512 | 514 |
513 #if ENABLE(WEB_AUDIO) | 515 #if ENABLE(WEB_AUDIO) |
514 // This is a weak reference, since m_audioSourceNode holds a reference to us
. | 516 // This is a weak reference, since m_audioSourceNode holds a reference to us
. |
515 // The value is set just after the MediaElementAudioSourceNode is created. | 517 // The value is set just after the MediaElementAudioSourceNode is created. |
516 // The value is cleared in MediaElementAudioSourceNode::~MediaElementAudioSo
urceNode(). | 518 // The value is cleared in MediaElementAudioSourceNode::~MediaElementAudioSo
urceNode(). |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 inline bool isHTMLMediaElement(const HTMLElement& element) | 555 inline bool isHTMLMediaElement(const HTMLElement& element) |
554 { | 556 { |
555 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 557 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
556 } | 558 } |
557 | 559 |
558 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 560 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
559 | 561 |
560 } //namespace | 562 } //namespace |
561 | 563 |
562 #endif | 564 #endif |
OLD | NEW |