| 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 15 matching lines...) Expand all Loading... |
| 26 #ifndef HTMLMediaElement_h | 26 #ifndef HTMLMediaElement_h |
| 27 #define HTMLMediaElement_h | 27 #define HTMLMediaElement_h |
| 28 | 28 |
| 29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
| 30 #include "core/dom/ActiveDOMObject.h" | 30 #include "core/dom/ActiveDOMObject.h" |
| 31 #include "core/events/GenericEventQueue.h" | 31 #include "core/events/GenericEventQueue.h" |
| 32 #include "core/html/AutoplayExperimentHelper.h" | 32 #include "core/html/AutoplayExperimentHelper.h" |
| 33 #include "core/html/HTMLElement.h" | 33 #include "core/html/HTMLElement.h" |
| 34 #include "core/html/track/TextTrack.h" | 34 #include "core/html/track/TextTrack.h" |
| 35 #include "platform/Supplementable.h" | 35 #include "platform/Supplementable.h" |
| 36 #include "platform/audio/AudioSourceProvider.h" |
| 37 #include "public/platform/WebAudioSourceProviderClient.h" |
| 36 #include "public/platform/WebMediaPlayerClient.h" | 38 #include "public/platform/WebMediaPlayerClient.h" |
| 37 #include "public/platform/WebMimeRegistry.h" | 39 #include "public/platform/WebMimeRegistry.h" |
| 38 | 40 |
| 39 #if ENABLE(WEB_AUDIO) | |
| 40 #include "platform/audio/AudioSourceProvider.h" | |
| 41 #include "public/platform/WebAudioSourceProviderClient.h" | |
| 42 #endif | |
| 43 | |
| 44 namespace blink { | 41 namespace blink { |
| 45 | 42 |
| 46 #if ENABLE(WEB_AUDIO) | |
| 47 class AudioSourceProviderClient; | 43 class AudioSourceProviderClient; |
| 48 class WebAudioSourceProvider; | |
| 49 #endif | |
| 50 class AudioTrackList; | 44 class AudioTrackList; |
| 51 class ContentType; | 45 class ContentType; |
| 52 class CueTimeline; | 46 class CueTimeline; |
| 53 class Event; | 47 class Event; |
| 54 class ExceptionState; | 48 class ExceptionState; |
| 55 class HTMLSourceElement; | 49 class HTMLSourceElement; |
| 56 class HTMLTrackElement; | 50 class HTMLTrackElement; |
| 57 class KURL; | 51 class KURL; |
| 58 class MediaControls; | 52 class MediaControls; |
| 59 class MediaError; | 53 class MediaError; |
| 60 class HTMLMediaSource; | 54 class HTMLMediaSource; |
| 61 class TextTrackContainer; | 55 class TextTrackContainer; |
| 62 class TextTrackList; | 56 class TextTrackList; |
| 63 class TimeRanges; | 57 class TimeRanges; |
| 64 class URLRegistry; | 58 class URLRegistry; |
| 65 class VideoTrackList; | 59 class VideoTrackList; |
| 60 class WebAudioSourceProvider; |
| 66 class WebInbandTextTrack; | 61 class WebInbandTextTrack; |
| 67 class WebLayer; | 62 class WebLayer; |
| 68 | 63 |
| 69 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple
mentable<HTMLMediaElement>, public ActiveDOMObject, private WebMediaPlayerClient
{ | 64 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple
mentable<HTMLMediaElement>, public ActiveDOMObject, private WebMediaPlayerClient
{ |
| 70 DEFINE_WRAPPERTYPEINFO(); | 65 DEFINE_WRAPPERTYPEINFO(); |
| 71 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); | 66 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); |
| 72 WILL_BE_USING_PRE_FINALIZER(HTMLMediaElement, dispose); | 67 WILL_BE_USING_PRE_FINALIZER(HTMLMediaElement, dispose); |
| 73 public: | 68 public: |
| 74 static WebMimeRegistry::SupportsType supportsType(const ContentType&, const
String& keySystem = String()); | 69 static WebMimeRegistry::SupportsType supportsType(const ContentType&, const
String& keySystem = String()); |
| 75 | 70 |
| 76 static void setMediaStreamRegistry(URLRegistry*); | 71 static void setMediaStreamRegistry(URLRegistry*); |
| 77 static bool isMediaStreamURL(const String& url); | 72 static bool isMediaStreamURL(const String& url); |
| 78 | 73 |
| 79 DECLARE_VIRTUAL_TRACE(); | 74 DECLARE_VIRTUAL_TRACE(); |
| 80 #if ENABLE(WEB_AUDIO) | |
| 81 void clearWeakMembers(Visitor*); | 75 void clearWeakMembers(Visitor*); |
| 82 #endif | |
| 83 WebMediaPlayer* webMediaPlayer() const | 76 WebMediaPlayer* webMediaPlayer() const |
| 84 { | 77 { |
| 85 return m_webMediaPlayer.get(); | 78 return m_webMediaPlayer.get(); |
| 86 } | 79 } |
| 87 | 80 |
| 88 virtual bool hasVideo() const { return false; } | 81 virtual bool hasVideo() const { return false; } |
| 89 bool hasAudio() const; | 82 bool hasAudio() const; |
| 90 | 83 |
| 91 bool supportsSave() const; | 84 bool supportsSave() const; |
| 92 | 85 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // Notifies the media element that the media controls became visible, so | 219 // Notifies the media element that the media controls became visible, so |
| 227 // that text track layout may be updated to avoid overlapping them. | 220 // that text track layout may be updated to avoid overlapping them. |
| 228 void mediaControlsDidBecomeVisible(); | 221 void mediaControlsDidBecomeVisible(); |
| 229 | 222 |
| 230 void sourceWasRemoved(HTMLSourceElement*); | 223 void sourceWasRemoved(HTMLSourceElement*); |
| 231 void sourceWasAdded(HTMLSourceElement*); | 224 void sourceWasAdded(HTMLSourceElement*); |
| 232 | 225 |
| 233 // ActiveDOMObject functions. | 226 // ActiveDOMObject functions. |
| 234 bool hasPendingActivity() const final; | 227 bool hasPendingActivity() const final; |
| 235 | 228 |
| 236 #if ENABLE(WEB_AUDIO) | |
| 237 AudioSourceProviderClient* audioSourceNode() { return m_audioSourceNode; } | 229 AudioSourceProviderClient* audioSourceNode() { return m_audioSourceNode; } |
| 238 void setAudioSourceNode(AudioSourceProviderClient*); | 230 void setAudioSourceNode(AudioSourceProviderClient*); |
| 239 | 231 |
| 240 AudioSourceProvider& audioSourceProvider() { return m_audioSourceProvider; } | 232 AudioSourceProvider& audioSourceProvider() { return m_audioSourceProvider; } |
| 241 #endif | |
| 242 | 233 |
| 243 enum InvalidURLAction { DoNothing, Complain }; | 234 enum InvalidURLAction { DoNothing, Complain }; |
| 244 bool isSafeToLoadURL(const KURL&, InvalidURLAction); | 235 bool isSafeToLoadURL(const KURL&, InvalidURLAction); |
| 245 | 236 |
| 246 // Checks to see if current media data is CORS-same-origin as the | 237 // Checks to see if current media data is CORS-same-origin as the |
| 247 // specified origin. | 238 // specified origin. |
| 248 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; | 239 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; |
| 249 | 240 |
| 250 void scheduleEvent(PassRefPtrWillBeRawPtr<Event>); | 241 void scheduleEvent(PassRefPtrWillBeRawPtr<Event>); |
| 251 void scheduleTimeupdateEvent(bool periodicEvent); | 242 void scheduleTimeupdateEvent(bool periodicEvent); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // Whether this element is in overlay fullscreen mode. | 550 // Whether this element is in overlay fullscreen mode. |
| 560 bool m_inOverlayFullscreenVideo : 1; | 551 bool m_inOverlayFullscreenVideo : 1; |
| 561 | 552 |
| 562 PersistentWillBeMember<AudioTrackList> m_audioTracks; | 553 PersistentWillBeMember<AudioTrackList> m_audioTracks; |
| 563 PersistentWillBeMember<VideoTrackList> m_videoTracks; | 554 PersistentWillBeMember<VideoTrackList> m_videoTracks; |
| 564 PersistentWillBeMember<TextTrackList> m_textTracks; | 555 PersistentWillBeMember<TextTrackList> m_textTracks; |
| 565 PersistentHeapVectorWillBeHeapVector<Member<TextTrack>> m_textTracksWhenReso
urceSelectionBegan; | 556 PersistentHeapVectorWillBeHeapVector<Member<TextTrack>> m_textTracksWhenReso
urceSelectionBegan; |
| 566 | 557 |
| 567 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; | 558 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; |
| 568 | 559 |
| 569 #if ENABLE(WEB_AUDIO) | |
| 570 // This is a weak reference, since m_audioSourceNode holds a reference to us
. | 560 // This is a weak reference, since m_audioSourceNode holds a reference to us
. |
| 571 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan
where strong cycles are not a problem. | 561 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan
where strong cycles are not a problem. |
| 572 GC_PLUGIN_IGNORE("http://crbug.com/404577") | 562 GC_PLUGIN_IGNORE("http://crbug.com/404577") |
| 573 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; | 563 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; |
| 574 | 564 |
| 575 // AudioClientImpl wraps an AudioSourceProviderClient. | 565 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 576 // When the audio format is known, Chromium calls setFormat(). | 566 // When the audio format is known, Chromium calls setFormat(). |
| 577 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm
pl>, public WebAudioSourceProviderClient { | 567 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm
pl>, public WebAudioSourceProviderClient { |
| 578 public: | 568 public: |
| 579 explicit AudioClientImpl(AudioSourceProviderClient* client) | 569 explicit AudioClientImpl(AudioSourceProviderClient* client) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 | 603 |
| 614 DECLARE_TRACE(); | 604 DECLARE_TRACE(); |
| 615 | 605 |
| 616 private: | 606 private: |
| 617 WebAudioSourceProvider* m_webAudioSourceProvider; | 607 WebAudioSourceProvider* m_webAudioSourceProvider; |
| 618 PersistentWillBeMember<AudioClientImpl> m_client; | 608 PersistentWillBeMember<AudioClientImpl> m_client; |
| 619 Mutex provideInputLock; | 609 Mutex provideInputLock; |
| 620 }; | 610 }; |
| 621 | 611 |
| 622 AudioSourceProviderImpl m_audioSourceProvider; | 612 AudioSourceProviderImpl m_audioSourceProvider; |
| 623 #endif | |
| 624 | 613 |
| 625 friend class Internals; | 614 friend class Internals; |
| 626 friend class TrackDisplayUpdateScope; | 615 friend class TrackDisplayUpdateScope; |
| 627 friend class AutoplayExperimentHelper; | 616 friend class AutoplayExperimentHelper; |
| 628 friend class MediaControlsTest; | 617 friend class MediaControlsTest; |
| 629 | 618 |
| 630 AutoplayExperimentHelper m_autoplayHelper; | 619 AutoplayExperimentHelper m_autoplayHelper; |
| 631 | 620 |
| 632 static URLRegistry* s_mediaStreamRegistry; | 621 static URLRegistry* s_mediaStreamRegistry; |
| 633 }; | 622 }; |
| 634 | 623 |
| 635 inline bool isHTMLMediaElement(const HTMLElement& element) | 624 inline bool isHTMLMediaElement(const HTMLElement& element) |
| 636 { | 625 { |
| 637 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 626 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 638 } | 627 } |
| 639 | 628 |
| 640 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 629 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 641 | 630 |
| 642 } // namespace blink | 631 } // namespace blink |
| 643 | 632 |
| 644 #endif // HTMLMediaElement_h | 633 #endif // HTMLMediaElement_h |
| OLD | NEW |