OLD | NEW |
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 Loading... |
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/core/v8/ScriptPromiseResolver.h" | 29 #include "bindings/core/v8/ScriptPromiseResolver.h" |
30 #include "bindings/core/v8/ScriptState.h" | 30 #include "bindings/core/v8/ScriptState.h" |
| 31 #include "core/dom/DOMArrayBuffer.h" |
| 32 #include "core/dom/DOMArrayBufferView.h" |
31 #include "core/dom/DOMException.h" | 33 #include "core/dom/DOMException.h" |
32 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
33 #include "core/dom/ExceptionCode.h" | 35 #include "core/dom/ExceptionCode.h" |
34 #include "core/dom/ExecutionContext.h" | 36 #include "core/dom/ExecutionContext.h" |
35 #include "modules/encryptedmedia/MediaKeyMessageEvent.h" | 37 #include "modules/encryptedmedia/MediaKeyMessageEvent.h" |
36 #include "modules/encryptedmedia/MediaKeySession.h" | 38 #include "modules/encryptedmedia/MediaKeySession.h" |
37 #include "modules/encryptedmedia/MediaKeysController.h" | 39 #include "modules/encryptedmedia/MediaKeysController.h" |
38 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResult.h" | 40 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResult.h" |
39 #include "platform/ContentType.h" | 41 #include "platform/ContentType.h" |
40 #include "platform/Logging.h" | 42 #include "platform/Logging.h" |
41 #include "platform/MIMETypeRegistry.h" | 43 #include "platform/MIMETypeRegistry.h" |
42 #include "platform/Timer.h" | 44 #include "platform/Timer.h" |
43 #include "platform/UUID.h" | 45 #include "platform/UUID.h" |
44 #include "public/platform/Platform.h" | 46 #include "public/platform/Platform.h" |
45 #include "public/platform/WebContentDecryptionModule.h" | 47 #include "public/platform/WebContentDecryptionModule.h" |
46 #include "wtf/ArrayBuffer.h" | |
47 #include "wtf/ArrayBufferView.h" | |
48 #include "wtf/RefPtr.h" | 48 #include "wtf/RefPtr.h" |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 static bool isKeySystemSupportedWithContentType(const String& keySystem, const S
tring& contentType) | 52 static bool isKeySystemSupportedWithContentType(const String& keySystem, const S
tring& contentType) |
53 { | 53 { |
54 ASSERT(!keySystem.isEmpty()); | 54 ASSERT(!keySystem.isEmpty()); |
55 | 55 |
56 ContentType type(contentType); | 56 ContentType type(contentType); |
57 String codecs = type.parameter("codecs"); | 57 String codecs = type.parameter("codecs"); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // FIXME: Check whether sessionType is actually supported by the CDM. | 235 // FIXME: Check whether sessionType is actually supported by the CDM. |
236 ASSERT(MediaKeySession::isValidSessionType(sessionType)); | 236 ASSERT(MediaKeySession::isValidSessionType(sessionType)); |
237 | 237 |
238 // 2. Let session be a new MediaKeySession object, and initialize it as | 238 // 2. Let session be a new MediaKeySession object, and initialize it as |
239 // follows: | 239 // follows: |
240 // (Initialization is performed in the constructor.) | 240 // (Initialization is performed in the constructor.) |
241 // 3. Return session. | 241 // 3. Return session. |
242 return MediaKeySession::create(scriptState, this, sessionType); | 242 return MediaKeySession::create(scriptState, this, sessionType); |
243 } | 243 } |
244 | 244 |
245 ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, ArrayBuf
fer* serverCertificate) | 245 ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, DOMArray
Buffer* serverCertificate) |
246 { | 246 { |
247 RefPtr<ArrayBuffer> serverCertificateCopy = ArrayBuffer::create(serverCertif
icate->data(), serverCertificate->byteLength()); | 247 RefPtr<ArrayBuffer> serverCertificateCopy = ArrayBuffer::create(serverCertif
icate->data(), serverCertificate->byteLength()); |
248 return setServerCertificateInternal(scriptState, serverCertificateCopy.relea
se()); | 248 return setServerCertificateInternal(scriptState, serverCertificateCopy.relea
se()); |
249 } | 249 } |
250 | 250 |
251 ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, ArrayBuf
ferView* serverCertificate) | 251 ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, DOMArray
BufferView* serverCertificate) |
252 { | 252 { |
253 RefPtr<ArrayBuffer> serverCertificateCopy = ArrayBuffer::create(serverCertif
icate->baseAddress(), serverCertificate->byteLength()); | 253 RefPtr<ArrayBuffer> serverCertificateCopy = ArrayBuffer::create(serverCertif
icate->baseAddress(), serverCertificate->byteLength()); |
254 return setServerCertificateInternal(scriptState, serverCertificateCopy.relea
se()); | 254 return setServerCertificateInternal(scriptState, serverCertificateCopy.relea
se()); |
255 } | 255 } |
256 | 256 |
257 ScriptPromise MediaKeys::setServerCertificateInternal(ScriptState* scriptState,
PassRefPtr<ArrayBuffer> serverCertificate) | 257 ScriptPromise MediaKeys::setServerCertificateInternal(ScriptState* scriptState,
PassRefPtr<ArrayBuffer> serverCertificate) |
258 { | 258 { |
259 // From https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e
ncrypted-media.html#dom-setservercertificate: | 259 // From https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e
ncrypted-media.html#dom-setservercertificate: |
260 // The setServerCertificate(serverCertificate) method provides a server | 260 // The setServerCertificate(serverCertificate) method provides a server |
261 // certificate to be used to encrypt messages to the license server. | 261 // certificate to be used to encrypt messages to the license server. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 348 |
349 void MediaKeys::contextDestroyed() | 349 void MediaKeys::contextDestroyed() |
350 { | 350 { |
351 ContextLifecycleObserver::contextDestroyed(); | 351 ContextLifecycleObserver::contextDestroyed(); |
352 | 352 |
353 // We don't need the CDM anymore. | 353 // We don't need the CDM anymore. |
354 m_cdm.clear(); | 354 m_cdm.clear(); |
355 } | 355 } |
356 | 356 |
357 } // namespace blink | 357 } // namespace blink |
OLD | NEW |