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

Side by Side Diff: third_party/WebKit/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp

Issue 1712903002: Remove prefixed EME. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix isRenewalMessage() in browser tests. Created 4 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" 5 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
11 #include "bindings/core/v8/V8Binding.h" 11 #include "bindings/core/v8/V8Binding.h"
12 #include "core/dom/DOMException.h" 12 #include "core/dom/DOMException.h"
13 #include "core/dom/DOMTypedArray.h" 13 #include "core/dom/DOMTypedArray.h"
14 #include "core/dom/ExceptionCode.h" 14 #include "core/dom/ExceptionCode.h"
15 #include "core/html/HTMLMediaElement.h" 15 #include "core/html/HTMLMediaElement.h"
16 #include "core/html/MediaKeyError.h"
17 #include "core/html/MediaKeyEvent.h"
18 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h" 16 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h"
19 #include "modules/encryptedmedia/EncryptedMediaUtils.h" 17 #include "modules/encryptedmedia/EncryptedMediaUtils.h"
20 #include "modules/encryptedmedia/MediaEncryptedEvent.h" 18 #include "modules/encryptedmedia/MediaEncryptedEvent.h"
21 #include "modules/encryptedmedia/MediaKeys.h" 19 #include "modules/encryptedmedia/MediaKeys.h"
22 #include "platform/ContentDecryptionModuleResult.h" 20 #include "platform/ContentDecryptionModuleResult.h"
23 #include "platform/Logging.h" 21 #include "platform/Logging.h"
24 #include "platform/RuntimeEnabledFeatures.h" 22 #include "platform/RuntimeEnabledFeatures.h"
25 #include "wtf/Functional.h" 23 #include "wtf/Functional.h"
26 24
27 namespace blink { 25 namespace blink {
28 26
29 static void throwExceptionIfMediaKeyExceptionOccurred(const String& keySystem, c onst String& sessionId, WebMediaPlayer::MediaKeyException exception, ExceptionSt ate& exceptionState)
30 {
31 switch (exception) {
32 case WebMediaPlayer::MediaKeyExceptionNoError:
33 return;
34 case WebMediaPlayer::MediaKeyExceptionInvalidPlayerState:
35 exceptionState.throwDOMException(InvalidStateError, "The player is in an invalid state.");
36 return;
37 case WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported:
38 exceptionState.throwDOMException(NotSupportedError, "The key system prov ided ('" + keySystem +"') is not supported.");
39 return;
40 case WebMediaPlayer::MediaKeyExceptionInvalidAccess:
41 exceptionState.throwDOMException(InvalidAccessError, "The session ID pro vided ('" + sessionId + "') is invalid.");
42 return;
43 }
44
45 ASSERT_NOT_REACHED();
46 return;
47 }
48
49 // This class allows MediaKeys to be set asynchronously. 27 // This class allows MediaKeys to be set asynchronously.
50 class SetMediaKeysHandler : public ScriptPromiseResolver { 28 class SetMediaKeysHandler : public ScriptPromiseResolver {
51 WTF_MAKE_NONCOPYABLE(SetMediaKeysHandler); 29 WTF_MAKE_NONCOPYABLE(SetMediaKeysHandler);
52 public: 30 public:
53 static ScriptPromise create(ScriptState*, HTMLMediaElement&, MediaKeys*); 31 static ScriptPromise create(ScriptState*, HTMLMediaElement&, MediaKeys*);
54 ~SetMediaKeysHandler() override; 32 ~SetMediaKeysHandler() override;
55 33
56 DECLARE_VIRTUAL_TRACE(); 34 DECLARE_VIRTUAL_TRACE();
57 35
58 private: 36 private:
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 263
286 DEFINE_TRACE(SetMediaKeysHandler) 264 DEFINE_TRACE(SetMediaKeysHandler)
287 { 265 {
288 visitor->trace(m_element); 266 visitor->trace(m_element);
289 visitor->trace(m_newMediaKeys); 267 visitor->trace(m_newMediaKeys);
290 ScriptPromiseResolver::trace(visitor); 268 ScriptPromiseResolver::trace(visitor);
291 } 269 }
292 270
293 HTMLMediaElementEncryptedMedia::HTMLMediaElementEncryptedMedia(HTMLMediaElement& element) 271 HTMLMediaElementEncryptedMedia::HTMLMediaElementEncryptedMedia(HTMLMediaElement& element)
294 : m_mediaElement(&element) 272 : m_mediaElement(&element)
295 , m_emeMode(EmeModeNotSelected)
296 , m_isWaitingForKey(false) 273 , m_isWaitingForKey(false)
297 { 274 {
298 } 275 }
299 276
300 HTMLMediaElementEncryptedMedia::~HTMLMediaElementEncryptedMedia() 277 HTMLMediaElementEncryptedMedia::~HTMLMediaElementEncryptedMedia()
301 { 278 {
302 #if !ENABLE(OILPAN) 279 #if !ENABLE(OILPAN)
303 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::~HTMLMediaElementEncryptedMe dia"); 280 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::~HTMLMediaElementEncryptedMe dia");
304 if (m_mediaKeys) 281 if (m_mediaKeys)
305 m_mediaKeys->clearMediaElement(); 282 m_mediaKeys->clearMediaElement();
306 #endif 283 #endif
307 } 284 }
308 285
309 const char* HTMLMediaElementEncryptedMedia::supplementName() 286 const char* HTMLMediaElementEncryptedMedia::supplementName()
310 { 287 {
311 return "HTMLMediaElementEncryptedMedia"; 288 return "HTMLMediaElementEncryptedMedia";
312 } 289 }
313 290
314 HTMLMediaElementEncryptedMedia& HTMLMediaElementEncryptedMedia::from(HTMLMediaEl ement& element) 291 HTMLMediaElementEncryptedMedia& HTMLMediaElementEncryptedMedia::from(HTMLMediaEl ement& element)
315 { 292 {
316 HTMLMediaElementEncryptedMedia* supplement = static_cast<HTMLMediaElementEnc ryptedMedia*>(WillBeHeapSupplement<HTMLMediaElement>::from(element, supplementNa me())); 293 HTMLMediaElementEncryptedMedia* supplement = static_cast<HTMLMediaElementEnc ryptedMedia*>(WillBeHeapSupplement<HTMLMediaElement>::from(element, supplementNa me()));
317 if (!supplement) { 294 if (!supplement) {
318 supplement = new HTMLMediaElementEncryptedMedia(element); 295 supplement = new HTMLMediaElementEncryptedMedia(element);
319 provideTo(element, supplementName(), adoptPtrWillBeNoop(supplement)); 296 provideTo(element, supplementName(), adoptPtrWillBeNoop(supplement));
320 } 297 }
321 return *supplement; 298 return *supplement;
322 } 299 }
323 300
324 bool HTMLMediaElementEncryptedMedia::setEmeMode(EmeMode emeMode)
325 {
326 if (m_emeMode != EmeModeNotSelected && m_emeMode != emeMode)
327 return false;
328
329 m_emeMode = emeMode;
330 return true;
331 }
332
333 MediaKeys* HTMLMediaElementEncryptedMedia::mediaKeys(HTMLMediaElement& element) 301 MediaKeys* HTMLMediaElementEncryptedMedia::mediaKeys(HTMLMediaElement& element)
334 { 302 {
335 HTMLMediaElementEncryptedMedia& thisElement = HTMLMediaElementEncryptedMedia ::from(element); 303 HTMLMediaElementEncryptedMedia& thisElement = HTMLMediaElementEncryptedMedia ::from(element);
336 return thisElement.m_mediaKeys.get(); 304 return thisElement.m_mediaKeys.get();
337 } 305 }
338 306
339 ScriptPromise HTMLMediaElementEncryptedMedia::setMediaKeys(ScriptState* scriptSt ate, HTMLMediaElement& element, MediaKeys* mediaKeys) 307 ScriptPromise HTMLMediaElementEncryptedMedia::setMediaKeys(ScriptState* scriptSt ate, HTMLMediaElement& element, MediaKeys* mediaKeys)
340 { 308 {
341 HTMLMediaElementEncryptedMedia& thisElement = HTMLMediaElementEncryptedMedia ::from(element); 309 HTMLMediaElementEncryptedMedia& thisElement = HTMLMediaElementEncryptedMedia ::from(element);
342 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::setMediaKeys current(%p), ne w(%p)", thisElement.m_mediaKeys.get(), mediaKeys); 310 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::setMediaKeys current(%p), ne w(%p)", thisElement.m_mediaKeys.get(), mediaKeys);
343 311
344 if (!thisElement.setEmeMode(EmeModeUnprefixed))
345 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, "Mixed use of EME prefixed and unprefixed API not allo wed."));
346
347 // 1. If mediaKeys and the mediaKeys attribute are the same object, return 312 // 1. If mediaKeys and the mediaKeys attribute are the same object, return
348 // a promise resolved with undefined. 313 // a promise resolved with undefined.
349 if (thisElement.m_mediaKeys == mediaKeys) 314 if (thisElement.m_mediaKeys == mediaKeys)
350 return ScriptPromise::cast(scriptState, v8::Undefined(scriptState->isola te())); 315 return ScriptPromise::cast(scriptState, v8::Undefined(scriptState->isola te()));
351 316
352 // 2. Let promise be a new promise. Remaining steps done in handler. 317 // 2. Let promise be a new promise. Remaining steps done in handler.
353 return SetMediaKeysHandler::create(scriptState, element, mediaKeys); 318 return SetMediaKeysHandler::create(scriptState, element, mediaKeys);
354 } 319 }
355 320
356 // Create a MediaEncryptedEvent for WD EME. 321 // Create a MediaEncryptedEvent for WD EME.
357 static PassRefPtrWillBeRawPtr<Event> createEncryptedEvent(WebEncryptedMediaInitD ataType initDataType, const unsigned char* initData, unsigned initDataLength) 322 static PassRefPtrWillBeRawPtr<Event> createEncryptedEvent(WebEncryptedMediaInitD ataType initDataType, const unsigned char* initData, unsigned initDataLength)
358 { 323 {
359 MediaEncryptedEventInit initializer; 324 MediaEncryptedEventInit initializer;
360 initializer.setInitDataType(EncryptedMediaUtils::convertFromInitDataType(ini tDataType)); 325 initializer.setInitDataType(EncryptedMediaUtils::convertFromInitDataType(ini tDataType));
361 initializer.setInitData(DOMArrayBuffer::create(initData, initDataLength)); 326 initializer.setInitData(DOMArrayBuffer::create(initData, initDataLength));
362 initializer.setBubbles(false); 327 initializer.setBubbles(false);
363 initializer.setCancelable(false); 328 initializer.setCancelable(false);
364 329
365 return MediaEncryptedEvent::create(EventTypeNames::encrypted, initializer); 330 return MediaEncryptedEvent::create(EventTypeNames::encrypted, initializer);
366 } 331 }
367 332
368 // Create a 'needkey' MediaKeyEvent for v0.1b EME.
369 static PassRefPtrWillBeRawPtr<Event> createWebkitNeedKeyEvent(const unsigned cha r* initData, unsigned initDataLength)
370 {
371 MediaKeyEventInit webkitInitializer;
372 webkitInitializer.setInitData(DOMUint8Array::create(initData, initDataLength ));
373
374 return MediaKeyEvent::create(EventTypeNames::webkitneedkey, webkitInitialize r);
375 }
376
377 void HTMLMediaElementEncryptedMedia::webkitGenerateKeyRequest(HTMLMediaElement& element, const String& keySystem, PassRefPtr<DOMUint8Array> initData, ExceptionS tate& exceptionState)
378 {
379 HTMLMediaElementEncryptedMedia::from(element).generateKeyRequest(element.web MediaPlayer(), keySystem, initData, exceptionState);
380 }
381
382 void HTMLMediaElementEncryptedMedia::generateKeyRequest(WebMediaPlayer* webMedia Player, const String& keySystem, PassRefPtr<DOMUint8Array> initData, ExceptionSt ate& exceptionState)
383 {
384 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::webkitGenerateKeyRequest");
385
386 if (!setEmeMode(EmeModePrefixed)) {
387 exceptionState.throwDOMException(InvalidStateError, "Mixed use of EME pr efixed and unprefixed API not allowed.");
388 return;
389 }
390
391 if (keySystem.isEmpty()) {
392 exceptionState.throwDOMException(SyntaxError, "The key system provided i s empty.");
393 return;
394 }
395
396 if (!webMediaPlayer) {
397 exceptionState.throwDOMException(InvalidStateError, "No media has been l oaded.");
398 return;
399 }
400
401 const unsigned char* initDataPointer = 0;
402 unsigned initDataLength = 0;
403 if (initData) {
404 initDataPointer = initData->data();
405 initDataLength = initData->length();
406 }
407
408 WebMediaPlayer::MediaKeyException result = webMediaPlayer->generateKeyReques t(keySystem, initDataPointer, initDataLength);
409 throwExceptionIfMediaKeyExceptionOccurred(keySystem, String(), result, excep tionState);
410 }
411
412 void HTMLMediaElementEncryptedMedia::webkitGenerateKeyRequest(HTMLMediaElement& mediaElement, const String& keySystem, ExceptionState& exceptionState)
413 {
414 webkitGenerateKeyRequest(mediaElement, keySystem, DOMUint8Array::create(0), exceptionState);
415 }
416
417 void HTMLMediaElementEncryptedMedia::webkitAddKey(HTMLMediaElement& element, con st String& keySystem, PassRefPtr<DOMUint8Array> key, PassRefPtr<DOMUint8Array> i nitData, const String& sessionId, ExceptionState& exceptionState)
418 {
419 HTMLMediaElementEncryptedMedia::from(element).addKey(element.webMediaPlayer( ), keySystem, key, initData, sessionId, exceptionState);
420 }
421
422 void HTMLMediaElementEncryptedMedia::addKey(WebMediaPlayer* webMediaPlayer, cons t String& keySystem, PassRefPtr<DOMUint8Array> key, PassRefPtr<DOMUint8Array> in itData, const String& sessionId, ExceptionState& exceptionState)
423 {
424 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::webkitAddKey");
425
426 if (!setEmeMode(EmeModePrefixed)) {
427 exceptionState.throwDOMException(InvalidStateError, "Mixed use of EME pr efixed and unprefixed API not allowed.");
428 return;
429 }
430
431 if (keySystem.isEmpty()) {
432 exceptionState.throwDOMException(SyntaxError, "The key system provided i s empty.");
433 return;
434 }
435
436 if (!key) {
437 exceptionState.throwDOMException(SyntaxError, "The key provided is inval id.");
438 return;
439 }
440
441 if (!key->length()) {
442 exceptionState.throwDOMException(TypeMismatchError, "The key provided is invalid.");
443 return;
444 }
445
446 if (!webMediaPlayer) {
447 exceptionState.throwDOMException(InvalidStateError, "No media has been l oaded.");
448 return;
449 }
450
451 const unsigned char* initDataPointer = 0;
452 unsigned initDataLength = 0;
453 if (initData) {
454 initDataPointer = initData->data();
455 initDataLength = initData->length();
456 }
457
458 WebMediaPlayer::MediaKeyException result = webMediaPlayer->addKey(keySystem, key->data(), key->length(), initDataPointer, initDataLength, sessionId);
459 throwExceptionIfMediaKeyExceptionOccurred(keySystem, sessionId, result, exce ptionState);
460 }
461
462 void HTMLMediaElementEncryptedMedia::webkitAddKey(HTMLMediaElement& mediaElement , const String& keySystem, PassRefPtr<DOMUint8Array> key, ExceptionState& except ionState)
463 {
464 webkitAddKey(mediaElement, keySystem, key, DOMUint8Array::create(0), String( ), exceptionState);
465 }
466
467 void HTMLMediaElementEncryptedMedia::webkitCancelKeyRequest(HTMLMediaElement& el ement, const String& keySystem, const String& sessionId, ExceptionState& excepti onState)
468 {
469 HTMLMediaElementEncryptedMedia::from(element).cancelKeyRequest(element.webMe diaPlayer(), keySystem, sessionId, exceptionState);
470 }
471
472 void HTMLMediaElementEncryptedMedia::cancelKeyRequest(WebMediaPlayer* webMediaPl ayer, const String& keySystem, const String& sessionId, ExceptionState& exceptio nState)
473 {
474 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::webkitCancelKeyRequest");
475
476 if (!setEmeMode(EmeModePrefixed)) {
477 exceptionState.throwDOMException(InvalidStateError, "Mixed use of EME pr efixed and unprefixed API not allowed.");
478 return;
479 }
480
481 if (keySystem.isEmpty()) {
482 exceptionState.throwDOMException(SyntaxError, "The key system provided i s empty.");
483 return;
484 }
485
486 if (!webMediaPlayer) {
487 exceptionState.throwDOMException(InvalidStateError, "No media has been l oaded.");
488 return;
489 }
490
491 WebMediaPlayer::MediaKeyException result = webMediaPlayer->cancelKeyRequest( keySystem, sessionId);
492 throwExceptionIfMediaKeyExceptionOccurred(keySystem, sessionId, result, exce ptionState);
493 }
494
495 void HTMLMediaElementEncryptedMedia::keyAdded(const WebString& keySystem, const WebString& sessionId)
496 {
497 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::mediaPlayerKeyAdded");
498
499 MediaKeyEventInit initializer;
500 initializer.setKeySystem(keySystem);
501 initializer.setSessionId(sessionId);
502
503 RefPtrWillBeRawPtr<Event> event = MediaKeyEvent::create(EventTypeNames::webk itkeyadded, initializer);
504 event->setTarget(m_mediaElement);
505 m_mediaElement->scheduleEvent(event.release());
506 }
507
508 void HTMLMediaElementEncryptedMedia::keyError(const WebString& keySystem, const WebString& sessionId, WebMediaPlayerEncryptedMediaClient::MediaKeyErrorCode erro rCode, unsigned short systemCode)
509 {
510 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::mediaPlayerKeyError: session ID=%s, errorCode=%d, systemCode=%d", sessionId.utf8().data(), errorCode, systemC ode);
511
512 MediaKeyError::Code mediaKeyErrorCode = MediaKeyError::MEDIA_KEYERR_UNKNOWN;
513 switch (errorCode) {
514 case WebMediaPlayerEncryptedMediaClient::MediaKeyErrorCodeUnknown:
515 mediaKeyErrorCode = MediaKeyError::MEDIA_KEYERR_UNKNOWN;
516 break;
517 case WebMediaPlayerEncryptedMediaClient::MediaKeyErrorCodeClient:
518 mediaKeyErrorCode = MediaKeyError::MEDIA_KEYERR_CLIENT;
519 break;
520 case WebMediaPlayerEncryptedMediaClient::MediaKeyErrorCodeService:
521 mediaKeyErrorCode = MediaKeyError::MEDIA_KEYERR_SERVICE;
522 break;
523 case WebMediaPlayerEncryptedMediaClient::MediaKeyErrorCodeOutput:
524 mediaKeyErrorCode = MediaKeyError::MEDIA_KEYERR_OUTPUT;
525 break;
526 case WebMediaPlayerEncryptedMediaClient::MediaKeyErrorCodeHardwareChange:
527 mediaKeyErrorCode = MediaKeyError::MEDIA_KEYERR_HARDWARECHANGE;
528 break;
529 case WebMediaPlayerEncryptedMediaClient::MediaKeyErrorCodeDomain:
530 mediaKeyErrorCode = MediaKeyError::MEDIA_KEYERR_DOMAIN;
531 break;
532 }
533
534 MediaKeyEventInit initializer;
535 initializer.setKeySystem(keySystem);
536 initializer.setSessionId(sessionId);
537 initializer.setErrorCode(MediaKeyError::create(mediaKeyErrorCode));
538 initializer.setSystemCode(systemCode);
539
540 RefPtrWillBeRawPtr<Event> event = MediaKeyEvent::create(EventTypeNames::webk itkeyerror, initializer);
541 event->setTarget(m_mediaElement);
542 m_mediaElement->scheduleEvent(event.release());
543 }
544
545 void HTMLMediaElementEncryptedMedia::keyMessage(const WebString& keySystem, cons t WebString& sessionId, const unsigned char* message, unsigned messageLength, co nst WebURL& defaultURL)
546 {
547 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::mediaPlayerKeyMessage: sessi onID=%s", sessionId.utf8().data());
548
549 MediaKeyEventInit initializer;
550 initializer.setKeySystem(keySystem);
551 initializer.setSessionId(sessionId);
552 initializer.setMessage(DOMUint8Array::create(message, messageLength));
553 initializer.setDefaultURL(KURL(defaultURL));
554
555 RefPtrWillBeRawPtr<Event> event = MediaKeyEvent::create(EventTypeNames::webk itkeymessage, initializer);
556 event->setTarget(m_mediaElement);
557 m_mediaElement->scheduleEvent(event.release());
558 }
559
560 void HTMLMediaElementEncryptedMedia::encrypted(WebEncryptedMediaInitDataType ini tDataType, const unsigned char* initData, unsigned initDataLength) 333 void HTMLMediaElementEncryptedMedia::encrypted(WebEncryptedMediaInitDataType ini tDataType, const unsigned char* initData, unsigned initDataLength)
561 { 334 {
562 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::encrypted"); 335 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::encrypted");
563 336
564 if (RuntimeEnabledFeatures::encryptedMediaEnabled()) { 337 if (RuntimeEnabledFeatures::encryptedMediaEnabled()) {
565 // Send event for WD EME. 338 // Send event for WD EME.
566 RefPtrWillBeRawPtr<Event> event; 339 RefPtrWillBeRawPtr<Event> event;
567 if (m_mediaElement->isMediaDataCORSSameOrigin(m_mediaElement->executionC ontext()->securityOrigin())) { 340 if (m_mediaElement->isMediaDataCORSSameOrigin(m_mediaElement->executionC ontext()->securityOrigin())) {
568 event = createEncryptedEvent(initDataType, initData, initDataLength) ; 341 event = createEncryptedEvent(initDataType, initData, initDataLength) ;
569 } else { 342 } else {
570 // Current page is not allowed to see content from the media file, 343 // Current page is not allowed to see content from the media file,
571 // so don't return the initData. However, they still get an event. 344 // so don't return the initData. However, they still get an event.
572 event = createEncryptedEvent(WebEncryptedMediaInitDataType::Unknown, nullptr, 0); 345 event = createEncryptedEvent(WebEncryptedMediaInitDataType::Unknown, nullptr, 0);
573 } 346 }
574 347
575 event->setTarget(m_mediaElement); 348 event->setTarget(m_mediaElement);
576 m_mediaElement->scheduleEvent(event.release()); 349 m_mediaElement->scheduleEvent(event.release());
577 } 350 }
578
579 if (RuntimeEnabledFeatures::prefixedEncryptedMediaEnabled()) {
580 // Send event for v0.1b EME.
581 RefPtrWillBeRawPtr<Event> event = createWebkitNeedKeyEvent(initData, ini tDataLength);
582 event->setTarget(m_mediaElement);
583 m_mediaElement->scheduleEvent(event.release());
584 }
585 } 351 }
586 352
587 void HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKey() 353 void HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKey()
588 { 354 {
589 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKe y"); 355 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKe y");
590 356
591 // From https://w3c.github.io/encrypted-media/#queue-waitingforkey: 357 // From https://w3c.github.io/encrypted-media/#queue-waitingforkey:
592 // It should only be called when the HTMLMediaElement object is potentially 358 // It should only be called when the HTMLMediaElement object is potentially
593 // playing and its readyState is equal to HAVE_FUTURE_DATA or greater. 359 // playing and its readyState is equal to HAVE_FUTURE_DATA or greater.
594 // FIXME: Is this really required? 360 // FIXME: Is this really required?
(...skipping 30 matching lines...) Expand all
625 } 391 }
626 392
627 DEFINE_TRACE(HTMLMediaElementEncryptedMedia) 393 DEFINE_TRACE(HTMLMediaElementEncryptedMedia)
628 { 394 {
629 visitor->trace(m_mediaElement); 395 visitor->trace(m_mediaElement);
630 visitor->trace(m_mediaKeys); 396 visitor->trace(m_mediaKeys);
631 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor); 397 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor);
632 } 398 }
633 399
634 } // namespace blink 400 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698