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

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: Fix compilation error on linux Created 6 years, 9 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
« no previous file with comments | « Source/core/DEPS ('k') | Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 { 75 {
77 public: 76 public:
78 static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&, const String& keySystem = String()); 77 static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&, const String& keySystem = String());
79 78
80 static void setMediaStreamRegistry(URLRegistry*); 79 static void setMediaStreamRegistry(URLRegistry*);
81 static bool isMediaStreamURL(const String& url); 80 static bool isMediaStreamURL(const String& url);
82 81
82 // Do not use player().
83 // FIXME: Replace all uses with webMediaPlayer() and remove this API.
83 MediaPlayer* player() const { return m_player.get(); } 84 MediaPlayer* player() const { return m_player.get(); }
85 blink::WebMediaPlayer* webMediaPlayer() const { return m_player ? m_player-> webMediaPlayer() : 0; }
84 86
85 virtual bool isVideo() const = 0; 87 virtual bool isVideo() const = 0;
86 virtual bool hasVideo() const OVERRIDE { return false; } 88 virtual bool hasVideo() const OVERRIDE { return false; }
87 virtual bool hasAudio() const OVERRIDE FINAL; 89 virtual bool hasAudio() const OVERRIDE FINAL;
88 90
89 bool supportsSave() const; 91 bool supportsSave() const;
90 92
91 blink::WebLayer* platformLayer() const; 93 blink::WebLayer* platformLayer() const;
92 94
93 enum DelayedActionType { 95 enum DelayedActionType {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 virtual void pause() OVERRIDE FINAL; 143 virtual void pause() OVERRIDE FINAL;
142 144
143 // statistics 145 // statistics
144 unsigned webkitAudioDecodedByteCount() const; 146 unsigned webkitAudioDecodedByteCount() const;
145 unsigned webkitVideoDecodedByteCount() const; 147 unsigned webkitVideoDecodedByteCount() const;
146 148
147 // media source extensions 149 // media source extensions
148 void closeMediaSource(); 150 void closeMediaSource();
149 void durationChanged(double duration); 151 void durationChanged(double duration);
150 152
151 // encrypted media extensions (v0.1b)
152 void webkitGenerateKeyRequest(const String& keySystem, PassRefPtr<Uint8Array > initData, ExceptionState&);
153 void webkitGenerateKeyRequest(const String& keySystem, ExceptionState&);
154 void webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, PassR efPtr<Uint8Array> initData, const String& sessionId, ExceptionState&);
155 void webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, Excep tionState&);
156 void webkitCancelKeyRequest(const String& keySystem, const String& sessionId , ExceptionState&);
157
158 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded);
159 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror);
160 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage);
161 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitneedkey);
162
163 // encrypted media extensions (WD)
164 MediaKeys* mediaKeys() const { return m_mediaKeys.get(); }
165 void setMediaKeys(MediaKeys*, ExceptionState&);
166 DEFINE_ATTRIBUTE_EVENT_LISTENER(needkey);
167
168 // controls 153 // controls
169 bool controls() const; 154 bool controls() const;
170 void setControls(bool); 155 void setControls(bool);
171 virtual double volume() const OVERRIDE FINAL; 156 virtual double volume() const OVERRIDE FINAL;
172 virtual void setVolume(double, ExceptionState&) OVERRIDE FINAL; 157 virtual void setVolume(double, ExceptionState&) OVERRIDE FINAL;
173 virtual bool muted() const OVERRIDE FINAL; 158 virtual bool muted() const OVERRIDE FINAL;
174 virtual void setMuted(bool) OVERRIDE FINAL; 159 virtual void setMuted(bool) OVERRIDE FINAL;
175 160
176 virtual void beginScrubbing() OVERRIDE FINAL; 161 virtual void beginScrubbing() OVERRIDE FINAL;
177 virtual void endScrubbing() OVERRIDE FINAL; 162 virtual void endScrubbing() OVERRIDE FINAL;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 257
273 AudioSourceProvider* audioSourceProvider(); 258 AudioSourceProvider* audioSourceProvider();
274 #endif 259 #endif
275 260
276 enum InvalidURLAction { DoNothing, Complain }; 261 enum InvalidURLAction { DoNothing, Complain };
277 bool isSafeToLoadURL(const KURL&, InvalidURLAction); 262 bool isSafeToLoadURL(const KURL&, InvalidURLAction);
278 263
279 MediaController* controller() const; 264 MediaController* controller() const;
280 void setController(PassRefPtr<MediaController>); // Resets the MediaGroup an d sets the MediaController. 265 void setController(PassRefPtr<MediaController>); // Resets the MediaGroup an d sets the MediaController.
281 266
267 void scheduleEvent(PassRefPtr<Event>);
268
282 protected: 269 protected:
283 HTMLMediaElement(const QualifiedName&, Document&); 270 HTMLMediaElement(const QualifiedName&, Document&);
284 virtual ~HTMLMediaElement(); 271 virtual ~HTMLMediaElement();
285 272
286 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 273 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
287 virtual void finishParsingChildren() OVERRIDE FINAL; 274 virtual void finishParsingChildren() OVERRIDE FINAL;
288 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; 275 virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
289 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; 276 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
290 277
291 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; 278 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 virtual void mediaPlayerNetworkStateChanged() OVERRIDE FINAL; 319 virtual void mediaPlayerNetworkStateChanged() OVERRIDE FINAL;
333 virtual void mediaPlayerReadyStateChanged() OVERRIDE FINAL; 320 virtual void mediaPlayerReadyStateChanged() OVERRIDE FINAL;
334 virtual void mediaPlayerTimeChanged() OVERRIDE FINAL; 321 virtual void mediaPlayerTimeChanged() OVERRIDE FINAL;
335 virtual void mediaPlayerDurationChanged() OVERRIDE FINAL; 322 virtual void mediaPlayerDurationChanged() OVERRIDE FINAL;
336 virtual void mediaPlayerPlaybackStateChanged() OVERRIDE FINAL; 323 virtual void mediaPlayerPlaybackStateChanged() OVERRIDE FINAL;
337 virtual void mediaPlayerRequestFullscreen() OVERRIDE FINAL; 324 virtual void mediaPlayerRequestFullscreen() OVERRIDE FINAL;
338 virtual void mediaPlayerRequestSeek(double) OVERRIDE FINAL; 325 virtual void mediaPlayerRequestSeek(double) OVERRIDE FINAL;
339 virtual void mediaPlayerRepaint() OVERRIDE FINAL; 326 virtual void mediaPlayerRepaint() OVERRIDE FINAL;
340 virtual void mediaPlayerSizeChanged() OVERRIDE FINAL; 327 virtual void mediaPlayerSizeChanged() OVERRIDE FINAL;
341 328
342 virtual void mediaPlayerKeyAdded(const String& keySystem, const String& sess ionId) OVERRIDE FINAL;
343 virtual void mediaPlayerKeyError(const String& keySystem, const String& sess ionId, MediaPlayerClient::MediaKeyErrorCode, unsigned short systemCode) OVERRIDE FINAL;
344 virtual void mediaPlayerKeyMessage(const String& keySystem, const String& se ssionId, const unsigned char* message, unsigned messageLength, const KURL& defau ltURL) OVERRIDE FINAL;
345 virtual bool mediaPlayerKeyNeeded(const String& contentType, const unsigned char* initData, unsigned initDataLength) OVERRIDE FINAL;
346
347 virtual CORSMode mediaPlayerCORSMode() const OVERRIDE FINAL; 329 virtual CORSMode mediaPlayerCORSMode() const OVERRIDE FINAL;
348 330
349 virtual void mediaPlayerSetWebLayer(blink::WebLayer*) OVERRIDE FINAL; 331 virtual void mediaPlayerSetWebLayer(blink::WebLayer*) OVERRIDE FINAL;
350 virtual void mediaPlayerSetOpaque(bool) OVERRIDE FINAL; 332 virtual void mediaPlayerSetOpaque(bool) OVERRIDE FINAL;
351 virtual void mediaPlayerMediaSourceOpened(blink::WebMediaSource*) OVERRIDE F INAL; 333 virtual void mediaPlayerMediaSourceOpened(blink::WebMediaSource*) OVERRIDE F INAL;
352 334
353 void loadTimerFired(Timer<HTMLMediaElement>*); 335 void loadTimerFired(Timer<HTMLMediaElement>*);
354 void progressEventTimerFired(Timer<HTMLMediaElement>*); 336 void progressEventTimerFired(Timer<HTMLMediaElement>*);
355 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); 337 void playbackProgressTimerFired(Timer<HTMLMediaElement>*);
356 void startPlaybackProgressTimer(); 338 void startPlaybackProgressTimer();
357 void startProgressEventTimer(); 339 void startProgressEventTimer();
358 void stopPeriodicTimers(); 340 void stopPeriodicTimers();
359 341
360 void seek(double time, ExceptionState&); 342 void seek(double time, ExceptionState&);
361 void finishSeek(); 343 void finishSeek();
362 void checkIfSeekNeeded(); 344 void checkIfSeekNeeded();
363 void addPlayedRange(double start, double end); 345 void addPlayedRange(double start, double end);
364 346
365 void scheduleTimeupdateEvent(bool periodicEvent); 347 void scheduleTimeupdateEvent(bool periodicEvent);
366 void scheduleEvent(const AtomicString& eventName); 348 void scheduleEvent(const AtomicString& eventName); // FIXME: Rename to sched uleNamedEvent for clarity.
367 349
368 // loading 350 // loading
369 void prepareForLoad(); 351 void prepareForLoad();
370 void loadInternal(); 352 void loadInternal();
371 void selectMediaResource(); 353 void selectMediaResource();
372 void loadResource(const KURL&, ContentType&, const String& keySystem); 354 void loadResource(const KURL&, ContentType&, const String& keySystem);
373 void scheduleNextSourceChild(); 355 void scheduleNextSourceChild();
374 void loadNextSourceChild(); 356 void loadNextSourceChild();
375 void userCancelledLoad(); 357 void userCancelledLoad();
376 void clearMediaPlayer(int flags); 358 void clearMediaPlayer(int flags);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 406
425 void changeNetworkStateFromLoadingToIdle(); 407 void changeNetworkStateFromLoadingToIdle();
426 408
427 const AtomicString& mediaGroup() const; 409 const AtomicString& mediaGroup() const;
428 void setMediaGroup(const AtomicString&); 410 void setMediaGroup(const AtomicString&);
429 void updateMediaController(); 411 void updateMediaController();
430 bool isBlocked() const; 412 bool isBlocked() const;
431 bool isBlockedOnMediaController() const; 413 bool isBlockedOnMediaController() const;
432 bool isAutoplaying() const { return m_autoplaying; } 414 bool isAutoplaying() const { return m_autoplaying; }
433 415
434 // Currently we have both EME v0.1b and EME WD implemented in media element.
435 // But we do not want to support both at the same time. The one used first
436 // will be supported. Use |m_emeMode| to track this selection.
437 // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24 9976.
438 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed };
439
440 // check (and set if necessary) the encrypted media extensions (EME) mode
441 // (v0.1b or WD). Returns whether the mode is allowed and successfully set.
442 bool setEmeMode(EmeMode, ExceptionState&);
443
444 blink::WebContentDecryptionModule* contentDecryptionModule();
445 void setMediaKeysInternal(MediaKeys*);
446
447 Timer<HTMLMediaElement> m_loadTimer; 416 Timer<HTMLMediaElement> m_loadTimer;
448 Timer<HTMLMediaElement> m_progressEventTimer; 417 Timer<HTMLMediaElement> m_progressEventTimer;
449 Timer<HTMLMediaElement> m_playbackProgressTimer; 418 Timer<HTMLMediaElement> m_playbackProgressTimer;
450 RefPtr<TimeRanges> m_playedTimeRanges; 419 RefPtr<TimeRanges> m_playedTimeRanges;
451 OwnPtr<GenericEventQueue> m_asyncEventQueue; 420 OwnPtr<GenericEventQueue> m_asyncEventQueue;
452 421
453 double m_playbackRate; 422 double m_playbackRate;
454 double m_defaultPlaybackRate; 423 double m_defaultPlaybackRate;
455 NetworkState m_networkState; 424 NetworkState m_networkState;
456 ReadyState m_readyState; 425 ReadyState m_readyState;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // The value is set just after the MediaElementAudioSourceNode is created. 510 // The value is set just after the MediaElementAudioSourceNode is created.
542 // The value is cleared in MediaElementAudioSourceNode::~MediaElementAudioSo urceNode(). 511 // The value is cleared in MediaElementAudioSourceNode::~MediaElementAudioSo urceNode().
543 MediaElementAudioSourceNode* m_audioSourceNode; 512 MediaElementAudioSourceNode* m_audioSourceNode;
544 #endif 513 #endif
545 514
546 friend class MediaController; 515 friend class MediaController;
547 RefPtr<MediaController> m_mediaController; 516 RefPtr<MediaController> m_mediaController;
548 517
549 friend class TrackDisplayUpdateScope; 518 friend class TrackDisplayUpdateScope;
550 519
551 EmeMode m_emeMode;
552
553 RefPtrWillBePersistent<MediaKeys> m_mediaKeys;
554
555 static URLRegistry* s_mediaStreamRegistry; 520 static URLRegistry* s_mediaStreamRegistry;
556 }; 521 };
557 522
558 #ifndef NDEBUG 523 #ifndef NDEBUG
559 // Template specializations required by PodIntervalTree in debug mode. 524 // Template specializations required by PodIntervalTree in debug mode.
560 template <> 525 template <>
561 struct ValueToString<double> { 526 struct ValueToString<double> {
562 static String string(const double value) 527 static String string(const double value)
563 { 528 {
564 return String::number(value); 529 return String::number(value);
(...skipping 12 matching lines...) Expand all
577 inline bool isHTMLMediaElement(const Node& node) 542 inline bool isHTMLMediaElement(const Node& node)
578 { 543 {
579 return node.isElementNode() && toElement(node).isMediaElement(); 544 return node.isElementNode() && toElement(node).isMediaElement();
580 } 545 }
581 546
582 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 547 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
583 548
584 } //namespace 549 } //namespace
585 550
586 #endif 551 #endif
OLDNEW
« no previous file with comments | « Source/core/DEPS ('k') | Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698