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

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

Issue 1742933002: Remove EME and MSE from RuntimeEnabledFeatures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 4 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
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 "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h" 16 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h"
17 #include "modules/encryptedmedia/EncryptedMediaUtils.h" 17 #include "modules/encryptedmedia/EncryptedMediaUtils.h"
18 #include "modules/encryptedmedia/MediaEncryptedEvent.h" 18 #include "modules/encryptedmedia/MediaEncryptedEvent.h"
19 #include "modules/encryptedmedia/MediaKeys.h" 19 #include "modules/encryptedmedia/MediaKeys.h"
20 #include "platform/ContentDecryptionModuleResult.h" 20 #include "platform/ContentDecryptionModuleResult.h"
21 #include "platform/Logging.h" 21 #include "platform/Logging.h"
22 #include "platform/RuntimeEnabledFeatures.h"
23 #include "wtf/Functional.h" 22 #include "wtf/Functional.h"
24 23
25 namespace blink { 24 namespace blink {
26 25
27 // This class allows MediaKeys to be set asynchronously. 26 // This class allows MediaKeys to be set asynchronously.
28 class SetMediaKeysHandler : public ScriptPromiseResolver { 27 class SetMediaKeysHandler : public ScriptPromiseResolver {
29 WTF_MAKE_NONCOPYABLE(SetMediaKeysHandler); 28 WTF_MAKE_NONCOPYABLE(SetMediaKeysHandler);
30 public: 29 public:
31 static ScriptPromise create(ScriptState*, HTMLMediaElement&, MediaKeys*); 30 static ScriptPromise create(ScriptState*, HTMLMediaElement&, MediaKeys*);
32 ~SetMediaKeysHandler() override; 31 ~SetMediaKeysHandler() override;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 initializer.setBubbles(false); 349 initializer.setBubbles(false);
351 initializer.setCancelable(false); 350 initializer.setCancelable(false);
352 351
353 return MediaEncryptedEvent::create(EventTypeNames::encrypted, initializer); 352 return MediaEncryptedEvent::create(EventTypeNames::encrypted, initializer);
354 } 353 }
355 354
356 void HTMLMediaElementEncryptedMedia::encrypted(WebEncryptedMediaInitDataType ini tDataType, const unsigned char* initData, unsigned initDataLength) 355 void HTMLMediaElementEncryptedMedia::encrypted(WebEncryptedMediaInitDataType ini tDataType, const unsigned char* initData, unsigned initDataLength)
357 { 356 {
358 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::encrypted"); 357 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::encrypted");
359 358
360 if (RuntimeEnabledFeatures::encryptedMediaEnabled()) { 359 RefPtrWillBeRawPtr<Event> event;
361 // Send event for WD EME. 360 if (m_mediaElement->isMediaDataCORSSameOrigin(m_mediaElement->executionConte xt()->securityOrigin())) {
362 RefPtrWillBeRawPtr<Event> event; 361 event = createEncryptedEvent(initDataType, initData, initDataLength);
363 if (m_mediaElement->isMediaDataCORSSameOrigin(m_mediaElement->executionC ontext()->securityOrigin())) { 362 } else {
364 event = createEncryptedEvent(initDataType, initData, initDataLength) ; 363 // Current page is not allowed to see content from the media file,
365 } else { 364 // so don't return the initData. However, they still get an event.
366 // Current page is not allowed to see content from the media file, 365 event = createEncryptedEvent(WebEncryptedMediaInitDataType::Unknown, nul lptr, 0);
367 // so don't return the initData. However, they still get an event. 366 }
368 event = createEncryptedEvent(WebEncryptedMediaInitDataType::Unknown, nullptr, 0);
369 }
370 367
371 event->setTarget(m_mediaElement); 368 event->setTarget(m_mediaElement);
372 m_mediaElement->scheduleEvent(event.release()); 369 m_mediaElement->scheduleEvent(event.release());
373 }
374 } 370 }
375 371
376 void HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKey() 372 void HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKey()
377 { 373 {
378 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKe y"); 374 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKe y");
379 375
380 // From https://w3c.github.io/encrypted-media/#queue-waitingforkey: 376 // From https://w3c.github.io/encrypted-media/#queue-waitingforkey:
381 // It should only be called when the HTMLMediaElement object is potentially 377 // It should only be called when the HTMLMediaElement object is potentially
382 // playing and its readyState is equal to HAVE_FUTURE_DATA or greater. 378 // playing and its readyState is equal to HAVE_FUTURE_DATA or greater.
383 // FIXME: Is this really required? 379 // FIXME: Is this really required?
(...skipping 30 matching lines...) Expand all
414 } 410 }
415 411
416 DEFINE_TRACE(HTMLMediaElementEncryptedMedia) 412 DEFINE_TRACE(HTMLMediaElementEncryptedMedia)
417 { 413 {
418 visitor->trace(m_mediaElement); 414 visitor->trace(m_mediaElement);
419 visitor->trace(m_mediaKeys); 415 visitor->trace(m_mediaKeys);
420 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor); 416 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor);
421 } 417 }
422 418
423 } // namespace blink 419 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698