| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #endif | 51 #endif |
| 52 class ContentType; | 52 class ContentType; |
| 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; | 58 class MediaController; |
| 59 class MediaControls; | 59 class MediaControls; |
| 60 class MediaError; | 60 class MediaError; |
| 61 class MediaKeys; | |
| 62 class HTMLMediaSource; | 61 class HTMLMediaSource; |
| 63 class TextTrackList; | 62 class TextTrackList; |
| 64 class TimeRanges; | 63 class TimeRanges; |
| 65 class URLRegistry; | 64 class URLRegistry; |
| 66 | 65 |
| 67 typedef PODIntervalTree<double, TextTrackCue*> CueIntervalTree; | 66 typedef PODIntervalTree<double, TextTrackCue*> CueIntervalTree; |
| 68 typedef CueIntervalTree::IntervalType CueInterval; | 67 typedef CueIntervalTree::IntervalType CueInterval; |
| 69 typedef Vector<CueInterval> CueList; | 68 typedef Vector<CueInterval> CueList; |
| 70 | 69 |
| 71 // FIXME: The inheritance from MediaPlayerClient here should be private inherita
nce. | 70 // FIXME: The inheritance from MediaPlayerClient here should be private inherita
nce. |
| 72 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so
it | 71 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so
it |
| 73 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. | 72 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. |
| 74 | 73 |
| 75 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, public Ac
tiveDOMObject, public MediaControllerInterface | 74 class HTMLMediaElement : public Supplementable<HTMLMediaElement>, public HTMLEle
ment, public MediaPlayerClient, public ActiveDOMObject, public MediaControllerIn
terface |
| 76 , private TextTrackClient | 75 , private TextTrackClient |
| 77 { | 76 { |
| 78 public: | 77 public: |
| 79 static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&,
const String& keySystem = String()); | 78 static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&,
const String& keySystem = String()); |
| 80 | 79 |
| 81 static void setMediaStreamRegistry(URLRegistry*); | 80 static void setMediaStreamRegistry(URLRegistry*); |
| 82 static bool isMediaStreamURL(const String& url); | 81 static bool isMediaStreamURL(const String& url); |
| 83 | 82 |
| 84 MediaPlayer* player() const { return m_player.get(); } | 83 MediaPlayer* player() const { return m_player.get(); } |
| 85 | 84 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 virtual void pause() OVERRIDE FINAL; | 141 virtual void pause() OVERRIDE FINAL; |
| 143 | 142 |
| 144 // statistics | 143 // statistics |
| 145 unsigned webkitAudioDecodedByteCount() const; | 144 unsigned webkitAudioDecodedByteCount() const; |
| 146 unsigned webkitVideoDecodedByteCount() const; | 145 unsigned webkitVideoDecodedByteCount() const; |
| 147 | 146 |
| 148 // media source extensions | 147 // media source extensions |
| 149 void closeMediaSource(); | 148 void closeMediaSource(); |
| 150 void durationChanged(double duration); | 149 void durationChanged(double duration); |
| 151 | 150 |
| 152 // encrypted media extensions (v0.1b) | |
| 153 void webkitGenerateKeyRequest(const String& keySystem, PassRefPtr<Uint8Array
> initData, ExceptionState&); | |
| 154 void webkitGenerateKeyRequest(const String& keySystem, ExceptionState&); | |
| 155 void webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, PassR
efPtr<Uint8Array> initData, const String& sessionId, ExceptionState&); | |
| 156 void webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, Excep
tionState&); | |
| 157 void webkitCancelKeyRequest(const String& keySystem, const String& sessionId
, ExceptionState&); | |
| 158 | |
| 159 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded); | |
| 160 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror); | |
| 161 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage); | |
| 162 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitneedkey); | |
| 163 | |
| 164 // encrypted media extensions (WD) | |
| 165 MediaKeys* mediaKeys() const { return m_mediaKeys.get(); } | |
| 166 void setMediaKeys(MediaKeys*, ExceptionState&); | |
| 167 DEFINE_ATTRIBUTE_EVENT_LISTENER(needkey); | |
| 168 | |
| 169 // controls | 151 // controls |
| 170 bool controls() const; | 152 bool controls() const; |
| 171 void setControls(bool); | 153 void setControls(bool); |
| 172 virtual double volume() const OVERRIDE FINAL; | 154 virtual double volume() const OVERRIDE FINAL; |
| 173 virtual void setVolume(double, ExceptionState&) OVERRIDE FINAL; | 155 virtual void setVolume(double, ExceptionState&) OVERRIDE FINAL; |
| 174 virtual bool muted() const OVERRIDE FINAL; | 156 virtual bool muted() const OVERRIDE FINAL; |
| 175 virtual void setMuted(bool) OVERRIDE FINAL; | 157 virtual void setMuted(bool) OVERRIDE FINAL; |
| 176 | 158 |
| 177 virtual void beginScrubbing() OVERRIDE FINAL; | 159 virtual void beginScrubbing() OVERRIDE FINAL; |
| 178 virtual void endScrubbing() OVERRIDE FINAL; | 160 virtual void endScrubbing() OVERRIDE FINAL; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 255 |
| 274 AudioSourceProvider* audioSourceProvider(); | 256 AudioSourceProvider* audioSourceProvider(); |
| 275 #endif | 257 #endif |
| 276 | 258 |
| 277 enum InvalidURLAction { DoNothing, Complain }; | 259 enum InvalidURLAction { DoNothing, Complain }; |
| 278 bool isSafeToLoadURL(const KURL&, InvalidURLAction); | 260 bool isSafeToLoadURL(const KURL&, InvalidURLAction); |
| 279 | 261 |
| 280 MediaController* controller() const; | 262 MediaController* controller() const; |
| 281 void setController(PassRefPtr<MediaController>); // Resets the MediaGroup an
d sets the MediaController. | 263 void setController(PassRefPtr<MediaController>); // Resets the MediaGroup an
d sets the MediaController. |
| 282 | 264 |
| 265 void scheduleEvent(PassRefPtr<Event>); |
| 266 |
| 283 protected: | 267 protected: |
| 284 HTMLMediaElement(const QualifiedName&, Document&); | 268 HTMLMediaElement(const QualifiedName&, Document&); |
| 285 virtual ~HTMLMediaElement(); | 269 virtual ~HTMLMediaElement(); |
| 286 | 270 |
| 287 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 271 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; |
| 288 virtual void finishParsingChildren() OVERRIDE FINAL; | 272 virtual void finishParsingChildren() OVERRIDE FINAL; |
| 289 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; | 273 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; |
| 290 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; | 274 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; |
| 291 | 275 |
| 292 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; | 276 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 virtual void mediaPlayerNetworkStateChanged() OVERRIDE FINAL; | 331 virtual void mediaPlayerNetworkStateChanged() OVERRIDE FINAL; |
| 348 virtual void mediaPlayerReadyStateChanged() OVERRIDE FINAL; | 332 virtual void mediaPlayerReadyStateChanged() OVERRIDE FINAL; |
| 349 virtual void mediaPlayerTimeChanged() OVERRIDE FINAL; | 333 virtual void mediaPlayerTimeChanged() OVERRIDE FINAL; |
| 350 virtual void mediaPlayerDurationChanged() OVERRIDE FINAL; | 334 virtual void mediaPlayerDurationChanged() OVERRIDE FINAL; |
| 351 virtual void mediaPlayerPlaybackStateChanged() OVERRIDE FINAL; | 335 virtual void mediaPlayerPlaybackStateChanged() OVERRIDE FINAL; |
| 352 virtual void mediaPlayerRequestFullscreen() OVERRIDE FINAL; | 336 virtual void mediaPlayerRequestFullscreen() OVERRIDE FINAL; |
| 353 virtual void mediaPlayerRequestSeek(double) OVERRIDE FINAL; | 337 virtual void mediaPlayerRequestSeek(double) OVERRIDE FINAL; |
| 354 virtual void mediaPlayerRepaint() OVERRIDE FINAL; | 338 virtual void mediaPlayerRepaint() OVERRIDE FINAL; |
| 355 virtual void mediaPlayerSizeChanged() OVERRIDE FINAL; | 339 virtual void mediaPlayerSizeChanged() OVERRIDE FINAL; |
| 356 | 340 |
| 357 virtual void mediaPlayerKeyAdded(const String& keySystem, const String& sess
ionId) OVERRIDE FINAL; | |
| 358 virtual void mediaPlayerKeyError(const String& keySystem, const String& sess
ionId, MediaPlayerClient::MediaKeyErrorCode, unsigned short systemCode) OVERRIDE
FINAL; | |
| 359 virtual void mediaPlayerKeyMessage(const String& keySystem, const String& se
ssionId, const unsigned char* message, unsigned messageLength, const KURL& defau
ltURL) OVERRIDE FINAL; | |
| 360 virtual bool mediaPlayerKeyNeeded(const String& contentType, const unsigned
char* initData, unsigned initDataLength) OVERRIDE FINAL; | |
| 361 | |
| 362 virtual CORSMode mediaPlayerCORSMode() const OVERRIDE FINAL; | 341 virtual CORSMode mediaPlayerCORSMode() const OVERRIDE FINAL; |
| 363 | 342 |
| 364 virtual void mediaPlayerSetWebLayer(blink::WebLayer*) OVERRIDE FINAL; | 343 virtual void mediaPlayerSetWebLayer(blink::WebLayer*) OVERRIDE FINAL; |
| 365 virtual void mediaPlayerSetOpaque(bool) OVERRIDE FINAL; | 344 virtual void mediaPlayerSetOpaque(bool) OVERRIDE FINAL; |
| 366 virtual void mediaPlayerMediaSourceOpened(blink::WebMediaSource*) OVERRIDE F
INAL; | 345 virtual void mediaPlayerMediaSourceOpened(blink::WebMediaSource*) OVERRIDE F
INAL; |
| 367 | 346 |
| 368 void loadTimerFired(Timer<HTMLMediaElement>*); | 347 void loadTimerFired(Timer<HTMLMediaElement>*); |
| 369 void progressEventTimerFired(Timer<HTMLMediaElement>*); | 348 void progressEventTimerFired(Timer<HTMLMediaElement>*); |
| 370 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); | 349 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); |
| 371 void startPlaybackProgressTimer(); | 350 void startPlaybackProgressTimer(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 420 |
| 442 void removeBehaviorsRestrictionsAfterFirstUserGesture(); | 421 void removeBehaviorsRestrictionsAfterFirstUserGesture(); |
| 443 | 422 |
| 444 const AtomicString& mediaGroup() const; | 423 const AtomicString& mediaGroup() const; |
| 445 void setMediaGroup(const AtomicString&); | 424 void setMediaGroup(const AtomicString&); |
| 446 void updateMediaController(); | 425 void updateMediaController(); |
| 447 bool isBlocked() const; | 426 bool isBlocked() const; |
| 448 bool isBlockedOnMediaController() const; | 427 bool isBlockedOnMediaController() const; |
| 449 bool isAutoplaying() const { return m_autoplaying; } | 428 bool isAutoplaying() const { return m_autoplaying; } |
| 450 | 429 |
| 451 // Currently we have both EME v0.1b and EME WD implemented in media element. | |
| 452 // But we do not want to support both at the same time. The one used first | |
| 453 // will be supported. Use |m_emeMode| to track this selection. | |
| 454 // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24
9976. | |
| 455 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed }; | |
| 456 | |
| 457 // check (and set if necessary) the encrypted media extensions (EME) mode | |
| 458 // (v0.1b or WD). Returns whether the mode is allowed and successfully set. | |
| 459 bool setEmeMode(EmeMode, ExceptionState&); | |
| 460 | |
| 461 blink::WebContentDecryptionModule* contentDecryptionModule(); | |
| 462 void setMediaKeysInternal(MediaKeys*); | |
| 463 | |
| 464 Timer<HTMLMediaElement> m_loadTimer; | 430 Timer<HTMLMediaElement> m_loadTimer; |
| 465 Timer<HTMLMediaElement> m_progressEventTimer; | 431 Timer<HTMLMediaElement> m_progressEventTimer; |
| 466 Timer<HTMLMediaElement> m_playbackProgressTimer; | 432 Timer<HTMLMediaElement> m_playbackProgressTimer; |
| 467 RefPtr<TimeRanges> m_playedTimeRanges; | 433 RefPtr<TimeRanges> m_playedTimeRanges; |
| 468 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 434 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| 469 | 435 |
| 470 double m_playbackRate; | 436 double m_playbackRate; |
| 471 double m_defaultPlaybackRate; | 437 double m_defaultPlaybackRate; |
| 472 NetworkState m_networkState; | 438 NetworkState m_networkState; |
| 473 ReadyState m_readyState; | 439 ReadyState m_readyState; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // The value is set just after the MediaElementAudioSourceNode is created. | 525 // The value is set just after the MediaElementAudioSourceNode is created. |
| 560 // The value is cleared in MediaElementAudioSourceNode::~MediaElementAudioSo
urceNode(). | 526 // The value is cleared in MediaElementAudioSourceNode::~MediaElementAudioSo
urceNode(). |
| 561 MediaElementAudioSourceNode* m_audioSourceNode; | 527 MediaElementAudioSourceNode* m_audioSourceNode; |
| 562 #endif | 528 #endif |
| 563 | 529 |
| 564 friend class MediaController; | 530 friend class MediaController; |
| 565 RefPtr<MediaController> m_mediaController; | 531 RefPtr<MediaController> m_mediaController; |
| 566 | 532 |
| 567 friend class TrackDisplayUpdateScope; | 533 friend class TrackDisplayUpdateScope; |
| 568 | 534 |
| 569 EmeMode m_emeMode; | |
| 570 | |
| 571 RefPtrWillBePersistent<MediaKeys> m_mediaKeys; | |
| 572 | |
| 573 static URLRegistry* s_mediaStreamRegistry; | 535 static URLRegistry* s_mediaStreamRegistry; |
| 574 }; | 536 }; |
| 575 | 537 |
| 576 #ifndef NDEBUG | 538 #ifndef NDEBUG |
| 577 // Template specializations required by PodIntervalTree in debug mode. | 539 // Template specializations required by PodIntervalTree in debug mode. |
| 578 template <> | 540 template <> |
| 579 struct ValueToString<double> { | 541 struct ValueToString<double> { |
| 580 static String string(const double value) | 542 static String string(const double value) |
| 581 { | 543 { |
| 582 return String::number(value); | 544 return String::number(value); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 595 inline bool isHTMLMediaElement(const Node& node) | 557 inline bool isHTMLMediaElement(const Node& node) |
| 596 { | 558 { |
| 597 return node.isElementNode() && toElement(node).isMediaElement(); | 559 return node.isElementNode() && toElement(node).isMediaElement(); |
| 598 } | 560 } |
| 599 | 561 |
| 600 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 562 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 601 | 563 |
| 602 } //namespace | 564 } //namespace |
| 603 | 565 |
| 604 #endif | 566 #endif |
| OLD | NEW |