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

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: 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 initializer.setBubbles(false); 326 initializer.setBubbles(false);
328 initializer.setCancelable(false); 327 initializer.setCancelable(false);
329 328
330 return MediaEncryptedEvent::create(EventTypeNames::encrypted, initializer); 329 return MediaEncryptedEvent::create(EventTypeNames::encrypted, initializer);
331 } 330 }
332 331
333 void HTMLMediaElementEncryptedMedia::encrypted(WebEncryptedMediaInitDataType ini tDataType, const unsigned char* initData, unsigned initDataLength) 332 void HTMLMediaElementEncryptedMedia::encrypted(WebEncryptedMediaInitDataType ini tDataType, const unsigned char* initData, unsigned initDataLength)
334 { 333 {
335 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::encrypted"); 334 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::encrypted");
336 335
337 if (RuntimeEnabledFeatures::encryptedMediaEnabled()) { 336 RefPtrWillBeRawPtr<Event> event;
338 // Send event for WD EME. 337 if (m_mediaElement->isMediaDataCORSSameOrigin(m_mediaElement->executionConte xt()->securityOrigin())) {
339 RefPtrWillBeRawPtr<Event> event; 338 event = createEncryptedEvent(initDataType, initData, initDataLength);
340 if (m_mediaElement->isMediaDataCORSSameOrigin(m_mediaElement->executionC ontext()->securityOrigin())) { 339 } else {
341 event = createEncryptedEvent(initDataType, initData, initDataLength) ; 340 // Current page is not allowed to see content from the media file,
342 } else { 341 // so don't return the initData. However, they still get an event.
343 // Current page is not allowed to see content from the media file, 342 event = createEncryptedEvent(WebEncryptedMediaInitDataType::Unknown, nul lptr, 0);
344 // so don't return the initData. However, they still get an event. 343 }
345 event = createEncryptedEvent(WebEncryptedMediaInitDataType::Unknown, nullptr, 0);
346 }
347 344
348 event->setTarget(m_mediaElement); 345 event->setTarget(m_mediaElement);
349 m_mediaElement->scheduleEvent(event.release()); 346 m_mediaElement->scheduleEvent(event.release());
350 }
351 } 347 }
352 348
353 void HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKey() 349 void HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKey()
354 { 350 {
355 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKe y"); 351 WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::didBlockPlaybackWaitingForKe y");
356 352
357 // From https://w3c.github.io/encrypted-media/#queue-waitingforkey: 353 // From https://w3c.github.io/encrypted-media/#queue-waitingforkey:
358 // It should only be called when the HTMLMediaElement object is potentially 354 // It should only be called when the HTMLMediaElement object is potentially
359 // playing and its readyState is equal to HAVE_FUTURE_DATA or greater. 355 // playing and its readyState is equal to HAVE_FUTURE_DATA or greater.
360 // FIXME: Is this really required? 356 // FIXME: Is this really required?
(...skipping 30 matching lines...) Expand all
391 } 387 }
392 388
393 DEFINE_TRACE(HTMLMediaElementEncryptedMedia) 389 DEFINE_TRACE(HTMLMediaElementEncryptedMedia)
394 { 390 {
395 visitor->trace(m_mediaElement); 391 visitor->trace(m_mediaElement);
396 visitor->trace(m_mediaKeys); 392 visitor->trace(m_mediaKeys);
397 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor); 393 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor);
398 } 394 }
399 395
400 } // namespace blink 396 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698