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

Side by Side Diff: Source/modules/encryptedmedia/MediaKeys.cpp

Issue 195053004: Create Pepper-based CDM for EME WD (Blink changes) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move provideMediaKeysTo() to MediaKeysController 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 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 10 matching lines...) Expand all
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE. 23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "modules/encryptedmedia/MediaKeys.h" 27 #include "modules/encryptedmedia/MediaKeys.h"
28 28
29 #include "bindings/v8/ExceptionState.h" 29 #include "bindings/v8/ExceptionState.h"
30 #include "core/dom/ContextLifecycleObserver.h" 30 #include "core/dom/ContextLifecycleObserver.h"
31 #include "core/dom/Document.h"
31 #include "core/dom/ExecutionContext.h" 32 #include "core/dom/ExecutionContext.h"
32 #include "core/events/ThreadLocalEventNames.h" 33 #include "core/events/ThreadLocalEventNames.h"
33 #include "core/html/HTMLMediaElement.h" 34 #include "core/html/HTMLMediaElement.h"
34 #include "modules/encryptedmedia/MediaKeyMessageEvent.h" 35 #include "modules/encryptedmedia/MediaKeyMessageEvent.h"
36 #include "modules/encryptedmedia/MediaKeysClient.h"
37 #include "modules/encryptedmedia/MediaKeysController.h"
35 #include "platform/ContentType.h" 38 #include "platform/ContentType.h"
36 #include "platform/Logging.h" 39 #include "platform/Logging.h"
37 #include "platform/MIMETypeRegistry.h" 40 #include "platform/MIMETypeRegistry.h"
38 #include "platform/UUID.h" 41 #include "platform/UUID.h"
39 #include "public/platform/Platform.h" 42 #include "public/platform/Platform.h"
40 #include "public/platform/WebContentDecryptionModule.h" 43 #include "public/platform/WebContentDecryptionModule.h"
41 #include "wtf/HashSet.h" 44 #include "wtf/HashSet.h"
42 45
43 namespace WebCore { 46 namespace WebCore {
44 47
(...skipping 18 matching lines...) Expand all
63 } 66 }
64 67
65 // 2. If keySystem is not one of the user agent's supported Key Systems, thr ow a NotSupportedError and abort these steps. 68 // 2. If keySystem is not one of the user agent's supported Key Systems, thr ow a NotSupportedError and abort these steps.
66 if (!isKeySystemSupportedWithContentType(keySystem, "")) { 69 if (!isKeySystemSupportedWithContentType(keySystem, "")) {
67 exceptionState.throwDOMException(NotSupportedError, "The '" + keySystem + "' key system is not supported."); 70 exceptionState.throwDOMException(NotSupportedError, "The '" + keySystem + "' key system is not supported.");
68 return nullptr; 71 return nullptr;
69 } 72 }
70 73
71 // 3. Let cdm be the content decryption module corresponding to keySystem. 74 // 3. Let cdm be the content decryption module corresponding to keySystem.
72 // 4. Load cdm if necessary. 75 // 4. Load cdm if necessary.
73 OwnPtr<blink::WebContentDecryptionModule> cdm = adoptPtr(blink::Platform::cu rrent()->createContentDecryptionModule(keySystem)); 76 Document* document = toDocument(context);
77 MediaKeysController* controller = MediaKeysController::from(document->page() );
78 OwnPtr<blink::WebContentDecryptionModule> cdm = controller->createContentDec ryptionModule(context, keySystem);
74 if (!cdm) { 79 if (!cdm) {
75 exceptionState.throwDOMException(NotSupportedError, "A content decryptio n module could not be loaded for the '" + keySystem + "' key system."); 80 exceptionState.throwDOMException(NotSupportedError, "A content decryptio n module could not be loaded for the '" + keySystem + "' key system.");
76 return nullptr; 81 return nullptr;
77 } 82 }
78 83
79 // 5. Create a new MediaKeys object. 84 // 5. Create a new MediaKeys object.
80 // 5.1 Let the keySystem attribute be keySystem. 85 // 5.1 Let the keySystem attribute be keySystem.
81 // 6. Return the new object to the caller. 86 // 6. Return the new object to the caller.
82 return adoptRefWillBeNoop(new MediaKeys(context, keySystem, cdm.release())); 87 return adoptRefWillBeNoop(new MediaKeys(context, keySystem, cdm.release()));
83 } 88 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 204
200 void MediaKeys::contextDestroyed() 205 void MediaKeys::contextDestroyed()
201 { 206 {
202 ContextLifecycleObserver::contextDestroyed(); 207 ContextLifecycleObserver::contextDestroyed();
203 208
204 // We don't need the CDM anymore. 209 // We don't need the CDM anymore.
205 m_cdm.clear(); 210 m_cdm.clear();
206 } 211 }
207 212
208 } 213 }
OLDNEW
« no previous file with comments | « no previous file | Source/modules/encryptedmedia/MediaKeysClient.h » ('j') | Source/web/MediaKeysClientImpl.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698