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 28 matching lines...) Expand all Loading... |
39 class WebLayer; | 39 class WebLayer; |
40 } | 40 } |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 class ContentType; | 44 class ContentType; |
45 class Event; | 45 class Event; |
46 class ExceptionState; | 46 class ExceptionState; |
47 class HTMLSourceElement; | 47 class HTMLSourceElement; |
48 class KURL; | 48 class KURL; |
49 class MediaController; | |
50 class MediaError; | 49 class MediaError; |
51 class HTMLMediaSource; | 50 class HTMLMediaSource; |
52 class TimeRanges; | 51 class TimeRanges; |
53 class URLRegistry; | 52 class URLRegistry; |
54 | 53 |
55 // FIXME: The inheritance from MediaPlayerClient here should be private inherita
nce. | 54 // FIXME: The inheritance from MediaPlayerClient here should be private inherita
nce. |
56 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so
it | 55 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so
it |
57 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. | 56 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. |
58 | 57 |
59 class HTMLMediaElement : public HTMLElement, public WillBeHeapSupplementable<HTM
LMediaElement>, public MediaPlayerClient, public ActiveDOMObject | 58 class HTMLMediaElement : public HTMLElement, public WillBeHeapSupplementable<HTM
LMediaElement>, public MediaPlayerClient, public ActiveDOMObject |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 156 |
158 bool isPlaying() const { return m_playing; } | 157 bool isPlaying() const { return m_playing; } |
159 | 158 |
160 // ActiveDOMObject functions. | 159 // ActiveDOMObject functions. |
161 virtual bool hasPendingActivity() const OVERRIDE FINAL; | 160 virtual bool hasPendingActivity() const OVERRIDE FINAL; |
162 virtual void contextDestroyed() OVERRIDE FINAL; | 161 virtual void contextDestroyed() OVERRIDE FINAL; |
163 | 162 |
164 enum InvalidURLAction { DoNothing, Complain }; | 163 enum InvalidURLAction { DoNothing, Complain }; |
165 bool isSafeToLoadURL(const KURL&, InvalidURLAction); | 164 bool isSafeToLoadURL(const KURL&, InvalidURLAction); |
166 | 165 |
167 MediaController* controller() const; | |
168 void setController(PassRefPtrWillBeRawPtr<MediaController>); // Resets the M
ediaGroup and sets the MediaController. | |
169 | |
170 void scheduleEvent(PassRefPtrWillBeRawPtr<Event>); | 166 void scheduleEvent(PassRefPtrWillBeRawPtr<Event>); |
171 | 167 |
172 // Returns the "effective media volume" value as specified in the HTML5 spec
. | 168 // Returns the "effective media volume" value as specified in the HTML5 spec
. |
173 double effectiveMediaVolume() const; | 169 double effectiveMediaVolume() const; |
174 | 170 |
175 #if ENABLE(OILPAN) | 171 #if ENABLE(OILPAN) |
176 bool isFinalizing() const { return m_isFinalizing; } | 172 bool isFinalizing() const { return m_isFinalizing; } |
177 | 173 |
178 // Oilpan: finalization of the media element is observable from its | 174 // Oilpan: finalization of the media element is observable from its |
179 // attached MediaSource; it entering a closed state. | 175 // attached MediaSource; it entering a closed state. |
(...skipping 17 matching lines...) Expand all Loading... |
197 virtual void finishParsingChildren() OVERRIDE FINAL; | 193 virtual void finishParsingChildren() OVERRIDE FINAL; |
198 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; | 194 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; |
199 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; | 195 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; |
200 | 196 |
201 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; | 197 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; |
202 | 198 |
203 enum DisplayMode { Unknown, Poster, PosterWaitingForVideo, Video }; | 199 enum DisplayMode { Unknown, Poster, PosterWaitingForVideo, Video }; |
204 DisplayMode displayMode() const { return m_displayMode; } | 200 DisplayMode displayMode() const { return m_displayMode; } |
205 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } | 201 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } |
206 | 202 |
207 void setControllerInternal(PassRefPtrWillBeRawPtr<MediaController>); | |
208 | |
209 private: | 203 private: |
210 void createMediaPlayer(); | 204 void createMediaPlayer(); |
211 | 205 |
212 virtual bool isMouseFocusable() const OVERRIDE FINAL; | 206 virtual bool isMouseFocusable() const OVERRIDE FINAL; |
213 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; | 207 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; |
214 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; | 208 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; |
215 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE F
INAL; | 209 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE F
INAL; |
216 virtual void didNotifySubtreeInsertionsToDocument() OVERRIDE; | 210 virtual void didNotifySubtreeInsertionsToDocument() OVERRIDE; |
217 virtual void removedFrom(ContainerNode*) OVERRIDE FINAL; | 211 virtual void removedFrom(ContainerNode*) OVERRIDE FINAL; |
218 virtual void didRecalcStyle(StyleRecalcChange) OVERRIDE FINAL; | 212 virtual void didRecalcStyle(StyleRecalcChange) OVERRIDE FINAL; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 302 |
309 void prepareMediaFragmentURI(); | 303 void prepareMediaFragmentURI(); |
310 void applyMediaFragmentURI(); | 304 void applyMediaFragmentURI(); |
311 | 305 |
312 virtual void* preDispatchEventHandler(Event*) OVERRIDE FINAL; | 306 virtual void* preDispatchEventHandler(Event*) OVERRIDE FINAL; |
313 | 307 |
314 void changeNetworkStateFromLoadingToIdle(); | 308 void changeNetworkStateFromLoadingToIdle(); |
315 | 309 |
316 const AtomicString& mediaGroup() const; | 310 const AtomicString& mediaGroup() const; |
317 void setMediaGroup(const AtomicString&); | 311 void setMediaGroup(const AtomicString&); |
318 void updateMediaController(); | |
319 bool isBlocked() const; | 312 bool isBlocked() const; |
320 bool isBlockedOnMediaController() const; | |
321 bool isAutoplaying() const { return m_autoplaying; } | 313 bool isAutoplaying() const { return m_autoplaying; } |
322 | 314 |
323 blink::WebMediaPlayer::CORSMode corsMode() const; | 315 blink::WebMediaPlayer::CORSMode corsMode() const; |
324 | 316 |
325 // Returns the "direction of playback" value as specified in the HTML5 spec. | 317 // Returns the "direction of playback" value as specified in the HTML5 spec. |
326 enum DirectionOfPlayback { Backward, Forward }; | 318 enum DirectionOfPlayback { Backward, Forward }; |
327 DirectionOfPlayback directionOfPlayback() const; | 319 DirectionOfPlayback directionOfPlayback() const; |
328 | 320 |
329 // Returns the "effective playback rate" value as specified in the HTML5 spe
c. | 321 // Returns the "effective playback rate" value as specified in the HTML5 spe
c. |
330 double effectivePlaybackRate() const; | 322 double effectivePlaybackRate() const; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 bool m_completelyLoaded : 1; | 415 bool m_completelyLoaded : 1; |
424 bool m_havePreparedToPlay : 1; | 416 bool m_havePreparedToPlay : 1; |
425 bool m_delayingLoadForPreloadNone : 1; | 417 bool m_delayingLoadForPreloadNone : 1; |
426 | 418 |
427 bool m_processingPreferenceChange : 1; | 419 bool m_processingPreferenceChange : 1; |
428 #if ENABLE(OILPAN) | 420 #if ENABLE(OILPAN) |
429 bool m_isFinalizing : 1; | 421 bool m_isFinalizing : 1; |
430 bool m_closeMediaSourceWhenFinalizing : 1; | 422 bool m_closeMediaSourceWhenFinalizing : 1; |
431 #endif | 423 #endif |
432 | 424 |
433 friend class MediaController; | |
434 RefPtrWillBeMember<MediaController> m_mediaController; | |
435 | |
436 static URLRegistry* s_mediaStreamRegistry; | 425 static URLRegistry* s_mediaStreamRegistry; |
437 }; | 426 }; |
438 | 427 |
439 #ifndef NDEBUG | 428 #ifndef NDEBUG |
440 // Template specializations required by PodIntervalTree in debug mode. | 429 // Template specializations required by PodIntervalTree in debug mode. |
441 template <> | 430 template <> |
442 struct ValueToString<double> { | 431 struct ValueToString<double> { |
443 static String string(const double value) | 432 static String string(const double value) |
444 { | 433 { |
445 return String::number(value); | 434 return String::number(value); |
446 } | 435 } |
447 }; | 436 }; |
448 #endif | 437 #endif |
449 | 438 |
450 inline bool isHTMLMediaElement(const HTMLElement& element) | 439 inline bool isHTMLMediaElement(const HTMLElement& element) |
451 { | 440 { |
452 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 441 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
453 } | 442 } |
454 | 443 |
455 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 444 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
456 | 445 |
457 } // namespace blink | 446 } // namespace blink |
458 | 447 |
459 #endif // HTMLMediaElement_h | 448 #endif // HTMLMediaElement_h |
OLD | NEW |