Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Side by Side Diff: Source/core/html/HTMLMediaElement.h

Issue 157423003: Remove the dependency on encryptedmedia from HTMLMediaElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review comments. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(); }
84 blink::WebMediaPlayer* webMediaPlayer() const { return m_player ? m_player-> webMediaPlayer() : 0; }
ddorwin 2014/02/27 00:37:59 This seems fishy and like a layering violation, th
acolwell GONE FROM CHROMIUM 2014/02/27 01:11:11 I asked him to put this here. The MediaPlayer laye
85 85
86 virtual bool isVideo() const = 0; 86 virtual bool isVideo() const = 0;
87 virtual bool hasVideo() const OVERRIDE { return false; } 87 virtual bool hasVideo() const OVERRIDE { return false; }
88 virtual bool hasAudio() const OVERRIDE FINAL; 88 virtual bool hasAudio() const OVERRIDE FINAL;
89 89
90 bool supportsSave() const; 90 bool supportsSave() const;
91 91
92 blink::WebLayer* platformLayer() const; 92 blink::WebLayer* platformLayer() const;
93 93
94 enum DelayedActionType { 94 enum DelayedActionType {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 virtual void pause() OVERRIDE FINAL; 142 virtual void pause() OVERRIDE FINAL;
143 143
144 // statistics 144 // statistics
145 unsigned webkitAudioDecodedByteCount() const; 145 unsigned webkitAudioDecodedByteCount() const;
146 unsigned webkitVideoDecodedByteCount() const; 146 unsigned webkitVideoDecodedByteCount() const;
147 147
148 // media source extensions 148 // media source extensions
149 void closeMediaSource(); 149 void closeMediaSource();
150 void durationChanged(double duration); 150 void durationChanged(double duration);
151 151
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 152 // controls
170 bool controls() const; 153 bool controls() const;
171 void setControls(bool); 154 void setControls(bool);
172 virtual double volume() const OVERRIDE FINAL; 155 virtual double volume() const OVERRIDE FINAL;
173 virtual void setVolume(double, ExceptionState&) OVERRIDE FINAL; 156 virtual void setVolume(double, ExceptionState&) OVERRIDE FINAL;
174 virtual bool muted() const OVERRIDE FINAL; 157 virtual bool muted() const OVERRIDE FINAL;
175 virtual void setMuted(bool) OVERRIDE FINAL; 158 virtual void setMuted(bool) OVERRIDE FINAL;
176 159
177 virtual void beginScrubbing() OVERRIDE FINAL; 160 virtual void beginScrubbing() OVERRIDE FINAL;
178 virtual void endScrubbing() OVERRIDE FINAL; 161 virtual void endScrubbing() OVERRIDE FINAL;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 256
274 AudioSourceProvider* audioSourceProvider(); 257 AudioSourceProvider* audioSourceProvider();
275 #endif 258 #endif
276 259
277 enum InvalidURLAction { DoNothing, Complain }; 260 enum InvalidURLAction { DoNothing, Complain };
278 bool isSafeToLoadURL(const KURL&, InvalidURLAction); 261 bool isSafeToLoadURL(const KURL&, InvalidURLAction);
279 262
280 MediaController* controller() const; 263 MediaController* controller() const;
281 void setController(PassRefPtr<MediaController>); // Resets the MediaGroup an d sets the MediaController. 264 void setController(PassRefPtr<MediaController>); // Resets the MediaGroup an d sets the MediaController.
282 265
266 void scheduleEvent(PassRefPtr<Event>);
267
283 protected: 268 protected:
284 HTMLMediaElement(const QualifiedName&, Document&); 269 HTMLMediaElement(const QualifiedName&, Document&);
285 virtual ~HTMLMediaElement(); 270 virtual ~HTMLMediaElement();
286 271
287 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 272 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
288 virtual void finishParsingChildren() OVERRIDE FINAL; 273 virtual void finishParsingChildren() OVERRIDE FINAL;
289 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; 274 virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
290 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; 275 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
291 276
292 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; 277 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 virtual void mediaPlayerNetworkStateChanged() OVERRIDE FINAL; 332 virtual void mediaPlayerNetworkStateChanged() OVERRIDE FINAL;
348 virtual void mediaPlayerReadyStateChanged() OVERRIDE FINAL; 333 virtual void mediaPlayerReadyStateChanged() OVERRIDE FINAL;
349 virtual void mediaPlayerTimeChanged() OVERRIDE FINAL; 334 virtual void mediaPlayerTimeChanged() OVERRIDE FINAL;
350 virtual void mediaPlayerDurationChanged() OVERRIDE FINAL; 335 virtual void mediaPlayerDurationChanged() OVERRIDE FINAL;
351 virtual void mediaPlayerPlaybackStateChanged() OVERRIDE FINAL; 336 virtual void mediaPlayerPlaybackStateChanged() OVERRIDE FINAL;
352 virtual void mediaPlayerRequestFullscreen() OVERRIDE FINAL; 337 virtual void mediaPlayerRequestFullscreen() OVERRIDE FINAL;
353 virtual void mediaPlayerRequestSeek(double) OVERRIDE FINAL; 338 virtual void mediaPlayerRequestSeek(double) OVERRIDE FINAL;
354 virtual void mediaPlayerRepaint() OVERRIDE FINAL; 339 virtual void mediaPlayerRepaint() OVERRIDE FINAL;
355 virtual void mediaPlayerSizeChanged() OVERRIDE FINAL; 340 virtual void mediaPlayerSizeChanged() OVERRIDE FINAL;
356 341
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; 342 virtual CORSMode mediaPlayerCORSMode() const OVERRIDE FINAL;
363 343
364 virtual void mediaPlayerSetWebLayer(blink::WebLayer*) OVERRIDE FINAL; 344 virtual void mediaPlayerSetWebLayer(blink::WebLayer*) OVERRIDE FINAL;
365 virtual void mediaPlayerSetOpaque(bool) OVERRIDE FINAL; 345 virtual void mediaPlayerSetOpaque(bool) OVERRIDE FINAL;
366 virtual void mediaPlayerMediaSourceOpened(blink::WebMediaSource*) OVERRIDE F INAL; 346 virtual void mediaPlayerMediaSourceOpened(blink::WebMediaSource*) OVERRIDE F INAL;
367 347
368 void loadTimerFired(Timer<HTMLMediaElement>*); 348 void loadTimerFired(Timer<HTMLMediaElement>*);
369 void progressEventTimerFired(Timer<HTMLMediaElement>*); 349 void progressEventTimerFired(Timer<HTMLMediaElement>*);
370 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); 350 void playbackProgressTimerFired(Timer<HTMLMediaElement>*);
371 void startPlaybackProgressTimer(); 351 void startPlaybackProgressTimer();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 421
442 void removeBehaviorsRestrictionsAfterFirstUserGesture(); 422 void removeBehaviorsRestrictionsAfterFirstUserGesture();
443 423
444 const AtomicString& mediaGroup() const; 424 const AtomicString& mediaGroup() const;
445 void setMediaGroup(const AtomicString&); 425 void setMediaGroup(const AtomicString&);
446 void updateMediaController(); 426 void updateMediaController();
447 bool isBlocked() const; 427 bool isBlocked() const;
448 bool isBlockedOnMediaController() const; 428 bool isBlockedOnMediaController() const;
449 bool isAutoplaying() const { return m_autoplaying; } 429 bool isAutoplaying() const { return m_autoplaying; }
450 430
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; 431 Timer<HTMLMediaElement> m_loadTimer;
465 Timer<HTMLMediaElement> m_progressEventTimer; 432 Timer<HTMLMediaElement> m_progressEventTimer;
466 Timer<HTMLMediaElement> m_playbackProgressTimer; 433 Timer<HTMLMediaElement> m_playbackProgressTimer;
467 RefPtr<TimeRanges> m_playedTimeRanges; 434 RefPtr<TimeRanges> m_playedTimeRanges;
468 OwnPtr<GenericEventQueue> m_asyncEventQueue; 435 OwnPtr<GenericEventQueue> m_asyncEventQueue;
469 436
470 double m_playbackRate; 437 double m_playbackRate;
471 double m_defaultPlaybackRate; 438 double m_defaultPlaybackRate;
472 NetworkState m_networkState; 439 NetworkState m_networkState;
473 ReadyState m_readyState; 440 ReadyState m_readyState;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 // The value is set just after the MediaElementAudioSourceNode is created. 526 // The value is set just after the MediaElementAudioSourceNode is created.
560 // The value is cleared in MediaElementAudioSourceNode::~MediaElementAudioSo urceNode(). 527 // The value is cleared in MediaElementAudioSourceNode::~MediaElementAudioSo urceNode().
561 MediaElementAudioSourceNode* m_audioSourceNode; 528 MediaElementAudioSourceNode* m_audioSourceNode;
562 #endif 529 #endif
563 530
564 friend class MediaController; 531 friend class MediaController;
565 RefPtr<MediaController> m_mediaController; 532 RefPtr<MediaController> m_mediaController;
566 533
567 friend class TrackDisplayUpdateScope; 534 friend class TrackDisplayUpdateScope;
568 535
569 EmeMode m_emeMode;
570
571 RefPtrWillBePersistent<MediaKeys> m_mediaKeys;
572
573 static URLRegistry* s_mediaStreamRegistry; 536 static URLRegistry* s_mediaStreamRegistry;
574 }; 537 };
575 538
576 #ifndef NDEBUG 539 #ifndef NDEBUG
577 // Template specializations required by PodIntervalTree in debug mode. 540 // Template specializations required by PodIntervalTree in debug mode.
578 template <> 541 template <>
579 struct ValueToString<double> { 542 struct ValueToString<double> {
580 static String string(const double value) 543 static String string(const double value)
581 { 544 {
582 return String::number(value); 545 return String::number(value);
(...skipping 12 matching lines...) Expand all
595 inline bool isHTMLMediaElement(const Node& node) 558 inline bool isHTMLMediaElement(const Node& node)
596 { 559 {
597 return node.isElementNode() && toElement(node).isMediaElement(); 560 return node.isElementNode() && toElement(node).isMediaElement();
598 } 561 }
599 562
600 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 563 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
601 564
602 } //namespace 565 } //namespace
603 566
604 #endif 567 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/HTMLMediaElement.cpp » ('j') | Source/core/html/HTMLMediaElement.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698