| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 class WebAudioSourceProvider; | 48 class WebAudioSourceProvider; |
| 49 #endif | 49 #endif |
| 50 class AudioTrackList; | 50 class AudioTrackList; |
| 51 class ContentType; | 51 class ContentType; |
| 52 class CueTimeline; | 52 class CueTimeline; |
| 53 class Event; | 53 class Event; |
| 54 class ExceptionState; | 54 class ExceptionState; |
| 55 class HTMLSourceElement; | 55 class HTMLSourceElement; |
| 56 class HTMLTrackElement; | 56 class HTMLTrackElement; |
| 57 class KURL; | 57 class KURL; |
| 58 class MediaController; | |
| 59 class MediaControls; | 58 class MediaControls; |
| 60 class MediaError; | 59 class MediaError; |
| 61 class HTMLMediaSource; | 60 class HTMLMediaSource; |
| 62 class TextTrackContainer; | 61 class TextTrackContainer; |
| 63 class TextTrackList; | 62 class TextTrackList; |
| 64 class TimeRanges; | 63 class TimeRanges; |
| 65 class URLRegistry; | 64 class URLRegistry; |
| 66 class VideoTrackList; | 65 class VideoTrackList; |
| 67 class WebInbandTextTrack; | 66 class WebInbandTextTrack; |
| 68 class WebLayer; | 67 class WebLayer; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 void load(); | 121 void load(); |
| 123 String canPlayType(const String& mimeType, const String& keySystem = String(
)) const; | 122 String canPlayType(const String& mimeType, const String& keySystem = String(
)) const; |
| 124 | 123 |
| 125 // ready state | 124 // ready state |
| 126 enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTUR
E_DATA, HAVE_ENOUGH_DATA }; | 125 enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTUR
E_DATA, HAVE_ENOUGH_DATA }; |
| 127 ReadyState readyState() const; | 126 ReadyState readyState() const; |
| 128 bool seeking() const; | 127 bool seeking() const; |
| 129 | 128 |
| 130 // playback state | 129 // playback state |
| 131 double currentTime() const; | 130 double currentTime() const; |
| 132 void setCurrentTime(double, ExceptionState&); | 131 void setCurrentTime(double); |
| 133 double duration() const; | 132 double duration() const; |
| 134 bool paused() const; | 133 bool paused() const; |
| 135 double defaultPlaybackRate() const; | 134 double defaultPlaybackRate() const; |
| 136 void setDefaultPlaybackRate(double); | 135 void setDefaultPlaybackRate(double); |
| 137 double playbackRate() const; | 136 double playbackRate() const; |
| 138 void setPlaybackRate(double); | 137 void setPlaybackRate(double); |
| 139 void updatePlaybackRate(); | 138 void updatePlaybackRate(); |
| 140 TimeRanges* played(); | 139 TimeRanges* played(); |
| 141 TimeRanges* seekable() const; | 140 TimeRanges* seekable() const; |
| 142 bool ended() const; | 141 bool ended() const; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 158 void closeMediaSource(); | 157 void closeMediaSource(); |
| 159 void durationChanged(double duration, bool requestSeek); | 158 void durationChanged(double duration, bool requestSeek); |
| 160 | 159 |
| 161 // controls | 160 // controls |
| 162 bool shouldShowControls() const; | 161 bool shouldShowControls() const; |
| 163 double volume() const; | 162 double volume() const; |
| 164 void setVolume(double, ExceptionState&); | 163 void setVolume(double, ExceptionState&); |
| 165 bool muted() const; | 164 bool muted() const; |
| 166 void setMuted(bool); | 165 void setMuted(bool); |
| 167 | 166 |
| 168 // play/pause toggling that uses the media controller if present. togglePlay
StateWillPlay() is | |
| 169 // true if togglePlayState() will call play() or unpause() on the media elem
ent or controller. | |
| 170 bool togglePlayStateWillPlay() const; | |
| 171 void togglePlayState(); | 167 void togglePlayState(); |
| 172 | 168 |
| 173 AudioTrackList& audioTracks(); | 169 AudioTrackList& audioTracks(); |
| 174 void audioTrackChanged(); | 170 void audioTrackChanged(); |
| 175 | 171 |
| 176 VideoTrackList& videoTracks(); | 172 VideoTrackList& videoTracks(); |
| 177 void selectedVideoTrackChanged(WebMediaPlayer::TrackId*); | 173 void selectedVideoTrackChanged(WebMediaPlayer::TrackId*); |
| 178 | 174 |
| 179 TextTrack* addTextTrack(const AtomicString& kind, const AtomicString& label,
const AtomicString& language, ExceptionState&); | 175 TextTrack* addTextTrack(const AtomicString& kind, const AtomicString& label,
const AtomicString& language, ExceptionState&); |
| 180 | 176 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 225 |
| 230 // Notifies the media element that the media controls became visible, so | 226 // Notifies the media element that the media controls became visible, so |
| 231 // that text track layout may be updated to avoid overlapping them. | 227 // that text track layout may be updated to avoid overlapping them. |
| 232 void mediaControlsDidBecomeVisible(); | 228 void mediaControlsDidBecomeVisible(); |
| 233 | 229 |
| 234 void sourceWasRemoved(HTMLSourceElement*); | 230 void sourceWasRemoved(HTMLSourceElement*); |
| 235 void sourceWasAdded(HTMLSourceElement*); | 231 void sourceWasAdded(HTMLSourceElement*); |
| 236 | 232 |
| 237 // ActiveDOMObject functions. | 233 // ActiveDOMObject functions. |
| 238 bool hasPendingActivity() const final; | 234 bool hasPendingActivity() const final; |
| 239 void contextDestroyed() final; | |
| 240 | 235 |
| 241 #if ENABLE(WEB_AUDIO) | 236 #if ENABLE(WEB_AUDIO) |
| 242 AudioSourceProviderClient* audioSourceNode() { return m_audioSourceNode; } | 237 AudioSourceProviderClient* audioSourceNode() { return m_audioSourceNode; } |
| 243 void setAudioSourceNode(AudioSourceProviderClient*); | 238 void setAudioSourceNode(AudioSourceProviderClient*); |
| 244 | 239 |
| 245 AudioSourceProvider& audioSourceProvider() { return m_audioSourceProvider; } | 240 AudioSourceProvider& audioSourceProvider() { return m_audioSourceProvider; } |
| 246 #endif | 241 #endif |
| 247 | 242 |
| 248 enum InvalidURLAction { DoNothing, Complain }; | 243 enum InvalidURLAction { DoNothing, Complain }; |
| 249 bool isSafeToLoadURL(const KURL&, InvalidURLAction); | 244 bool isSafeToLoadURL(const KURL&, InvalidURLAction); |
| 250 | 245 |
| 251 // Checks to see if current media data is CORS-same-origin as the | 246 // Checks to see if current media data is CORS-same-origin as the |
| 252 // specified origin. | 247 // specified origin. |
| 253 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; | 248 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; |
| 254 | 249 |
| 255 MediaController* controller() const; | |
| 256 void setController(MediaController*); // Resets the MediaGroup and sets the
MediaController. | |
| 257 | |
| 258 void scheduleEvent(PassRefPtrWillBeRawPtr<Event>); | 250 void scheduleEvent(PassRefPtrWillBeRawPtr<Event>); |
| 259 void scheduleTimeupdateEvent(bool periodicEvent); | 251 void scheduleTimeupdateEvent(bool periodicEvent); |
| 260 | 252 |
| 261 // Returns the "effective media volume" value as specified in the HTML5 spec
. | 253 // Returns the "effective media volume" value as specified in the HTML5 spec
. |
| 262 double effectiveMediaVolume() const; | 254 double effectiveMediaVolume() const; |
| 263 | 255 |
| 264 // Predicates also used when dispatching wrapper creation (cf. [SpecialWrapF
or] IDL attribute usage.) | 256 // Predicates also used when dispatching wrapper creation (cf. [SpecialWrapF
or] IDL attribute usage.) |
| 265 virtual bool isHTMLAudioElement() const { return false; } | 257 virtual bool isHTMLAudioElement() const { return false; } |
| 266 virtual bool isHTMLVideoElement() const { return false; } | 258 virtual bool isHTMLVideoElement() const { return false; } |
| 267 | 259 |
| 268 protected: | 260 protected: |
| 269 HTMLMediaElement(const QualifiedName&, Document&); | 261 HTMLMediaElement(const QualifiedName&, Document&); |
| 270 ~HTMLMediaElement() override; | 262 ~HTMLMediaElement() override; |
| 271 #if ENABLE(OILPAN) | 263 #if ENABLE(OILPAN) |
| 272 void dispose(); | 264 void dispose(); |
| 273 #endif | 265 #endif |
| 274 | 266 |
| 275 void parseAttribute(const QualifiedName&, const AtomicString&) override; | 267 void parseAttribute(const QualifiedName&, const AtomicString&) override; |
| 276 void finishParsingChildren() final; | 268 void finishParsingChildren() final; |
| 277 bool isURLAttribute(const Attribute&) const override; | 269 bool isURLAttribute(const Attribute&) const override; |
| 278 void attach(const AttachContext& = AttachContext()) override; | 270 void attach(const AttachContext& = AttachContext()) override; |
| 279 | 271 |
| 280 void didMoveToNewDocument(Document& oldDocument) override; | 272 void didMoveToNewDocument(Document& oldDocument) override; |
| 281 virtual KURL posterImageURL() const { return KURL(); } | 273 virtual KURL posterImageURL() const { return KURL(); } |
| 282 | 274 |
| 283 enum DisplayMode { Unknown, Poster, Video }; | 275 enum DisplayMode { Unknown, Poster, Video }; |
| 284 DisplayMode displayMode() const { return m_displayMode; } | 276 DisplayMode displayMode() const { return m_displayMode; } |
| 285 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } | 277 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } |
| 286 | 278 |
| 287 void setControllerInternal(MediaController*); | |
| 288 | |
| 289 private: | 279 private: |
| 290 void resetMediaPlayerAndMediaSource(); | 280 void resetMediaPlayerAndMediaSource(); |
| 291 | 281 |
| 292 bool alwaysCreateUserAgentShadowRoot() const final { return true; } | 282 bool alwaysCreateUserAgentShadowRoot() const final { return true; } |
| 293 bool areAuthorShadowsAllowed() const final { return false; } | 283 bool areAuthorShadowsAllowed() const final { return false; } |
| 294 | 284 |
| 295 bool supportsFocus() const final; | 285 bool supportsFocus() const final; |
| 296 bool isMouseFocusable() const final; | 286 bool isMouseFocusable() const final; |
| 297 bool layoutObjectIsNeeded(const ComputedStyle&) override; | 287 bool layoutObjectIsNeeded(const ComputedStyle&) override; |
| 298 LayoutObject* createLayoutObject(const ComputedStyle&) override; | 288 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 407 |
| 418 void ensureMediaControls(); | 408 void ensureMediaControls(); |
| 419 void configureMediaControls(); | 409 void configureMediaControls(); |
| 420 | 410 |
| 421 TextTrackContainer& ensureTextTrackContainer(); | 411 TextTrackContainer& ensureTextTrackContainer(); |
| 422 | 412 |
| 423 void* preDispatchEventHandler(Event*) final; | 413 void* preDispatchEventHandler(Event*) final; |
| 424 | 414 |
| 425 void changeNetworkStateFromLoadingToIdle(); | 415 void changeNetworkStateFromLoadingToIdle(); |
| 426 | 416 |
| 427 const AtomicString& mediaGroup() const; | |
| 428 void setMediaGroup(const AtomicString&); | |
| 429 void updateMediaController(); | |
| 430 bool isBlocked() const; | |
| 431 bool isBlockedOnMediaController() const; | |
| 432 bool isAutoplaying() const { return m_autoplaying; } | 417 bool isAutoplaying() const { return m_autoplaying; } |
| 433 | 418 |
| 434 void setAllowHiddenVolumeControls(bool); | 419 void setAllowHiddenVolumeControls(bool); |
| 435 | 420 |
| 436 void recordAutoplayMetric(AutoplayMetrics); | 421 void recordAutoplayMetric(AutoplayMetrics); |
| 437 | 422 |
| 438 WebMediaPlayer::CORSMode corsMode() const; | 423 WebMediaPlayer::CORSMode corsMode() const; |
| 439 | 424 |
| 440 // Returns the "direction of playback" value as specified in the HTML5 spec. | 425 // Returns the "direction of playback" value as specified in the HTML5 spec. |
| 441 enum DirectionOfPlayback { Backward, Forward }; | 426 enum DirectionOfPlayback { Backward, Forward }; |
| 442 DirectionOfPlayback directionOfPlayback() const; | 427 DirectionOfPlayback directionOfPlayback() const; |
| 443 | 428 |
| 444 // Returns the "effective playback rate" value as specified in the HTML5 spe
c. | |
| 445 double effectivePlaybackRate() const; | |
| 446 | |
| 447 // Creates placeholder AudioTrack and/or VideoTrack objects when WebMemediaP
layer objects | 429 // Creates placeholder AudioTrack and/or VideoTrack objects when WebMemediaP
layer objects |
| 448 // advertise they have audio and/or video, but don't explicitly signal them
via | 430 // advertise they have audio and/or video, but don't explicitly signal them
via |
| 449 // addAudioTrack() and addVideoTrack(). | 431 // addAudioTrack() and addVideoTrack(). |
| 450 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. | 432 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. |
| 451 void createPlaceholderTracksIfNecessary(); | 433 void createPlaceholderTracksIfNecessary(); |
| 452 | 434 |
| 453 // Sets the selected/enabled tracks if they aren't set before we initially | 435 // Sets the selected/enabled tracks if they aren't set before we initially |
| 454 // transition to HAVE_METADATA. | 436 // transition to HAVE_METADATA. |
| 455 void selectInitialTracksIfNecessary(); | 437 void selectInitialTracksIfNecessary(); |
| 456 | 438 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 604 |
| 623 private: | 605 private: |
| 624 WebAudioSourceProvider* m_webAudioSourceProvider; | 606 WebAudioSourceProvider* m_webAudioSourceProvider; |
| 625 PersistentWillBeMember<AudioClientImpl> m_client; | 607 PersistentWillBeMember<AudioClientImpl> m_client; |
| 626 Mutex provideInputLock; | 608 Mutex provideInputLock; |
| 627 }; | 609 }; |
| 628 | 610 |
| 629 AudioSourceProviderImpl m_audioSourceProvider; | 611 AudioSourceProviderImpl m_audioSourceProvider; |
| 630 #endif | 612 #endif |
| 631 | 613 |
| 632 friend class MediaController; | |
| 633 PersistentWillBeMember<MediaController> m_mediaController; | |
| 634 | |
| 635 friend class Internals; | 614 friend class Internals; |
| 636 friend class TrackDisplayUpdateScope; | 615 friend class TrackDisplayUpdateScope; |
| 637 friend class AutoplayExperimentHelper; | 616 friend class AutoplayExperimentHelper; |
| 638 | 617 |
| 639 AutoplayExperimentHelper m_autoplayHelper; | 618 AutoplayExperimentHelper m_autoplayHelper; |
| 640 | 619 |
| 641 static URLRegistry* s_mediaStreamRegistry; | 620 static URLRegistry* s_mediaStreamRegistry; |
| 642 }; | 621 }; |
| 643 | 622 |
| 644 inline bool isHTMLMediaElement(const HTMLElement& element) | 623 inline bool isHTMLMediaElement(const HTMLElement& element) |
| 645 { | 624 { |
| 646 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 625 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 647 } | 626 } |
| 648 | 627 |
| 649 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 628 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 650 | 629 |
| 651 } // namespace blink | 630 } // namespace blink |
| 652 | 631 |
| 653 #endif // HTMLMediaElement_h | 632 #endif // HTMLMediaElement_h |
| OLD | NEW |