| 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 #if ENABLE(ASSERT) | 50 #if ENABLE(ASSERT) |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 // The list of possible values for |sessionType| passed to createSession(). | 53 // The list of possible values for |sessionType| passed to createSession(). |
| 54 const char* kTemporary = "temporary"; | 54 const char* kTemporary = "temporary"; |
| 55 const char* kPersistent = "persistent"; | 55 const char* kPersistent = "persistent"; |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // FIXME: Check whether sessionType is actually supported by the CDM. | 245 // FIXME: Check whether sessionType is actually supported by the CDM. |
| 246 ASSERT(sessionType == kTemporary || sessionType == kPersistent); | 246 ASSERT(sessionType == kTemporary || sessionType == kPersistent); |
| 247 | 247 |
| 248 // 2. Let session be a new MediaKeySession object, and initialize it as | 248 // 2. Let session be a new MediaKeySession object, and initialize it as |
| 249 // follows: | 249 // follows: |
| 250 // (Initialization is performed in the constructor.) | 250 // (Initialization is performed in the constructor.) |
| 251 // 3. Return session. | 251 // 3. Return session. |
| 252 return MediaKeySession::create(scriptState, this, sessionType); | 252 return MediaKeySession::create(scriptState, this, sessionType); |
| 253 } | 253 } |
| 254 | 254 |
| 255 ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, ArrayBuf
fer* serverCertificate) | 255 ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, DOMArray
Buffer* serverCertificate) |
| 256 { | 256 { |
| 257 RefPtr<ArrayBuffer> serverCertificateCopy = ArrayBuffer::create(serverCertif
icate->data(), serverCertificate->byteLength()); | 257 RefPtr<ArrayBuffer> serverCertificateCopy = ArrayBuffer::create(serverCertif
icate->data(), serverCertificate->byteLength()); |
| 258 return setServerCertificateInternal(scriptState, serverCertificateCopy.relea
se()); | 258 return setServerCertificateInternal(scriptState, serverCertificateCopy.relea
se()); |
| 259 } | 259 } |
| 260 | 260 |
| 261 ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, ArrayBuf
ferView* serverCertificate) | 261 ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, DOMArray
BufferView* serverCertificate) |
| 262 { | 262 { |
| 263 RefPtr<ArrayBuffer> serverCertificateCopy = ArrayBuffer::create(serverCertif
icate->baseAddress(), serverCertificate->byteLength()); | 263 RefPtr<ArrayBuffer> serverCertificateCopy = ArrayBuffer::create(serverCertif
icate->baseAddress(), serverCertificate->byteLength()); |
| 264 return setServerCertificateInternal(scriptState, serverCertificateCopy.relea
se()); | 264 return setServerCertificateInternal(scriptState, serverCertificateCopy.relea
se()); |
| 265 } | 265 } |
| 266 | 266 |
| 267 ScriptPromise MediaKeys::setServerCertificateInternal(ScriptState* scriptState,
PassRefPtr<ArrayBuffer> serverCertificate) | 267 ScriptPromise MediaKeys::setServerCertificateInternal(ScriptState* scriptState,
PassRefPtr<ArrayBuffer> serverCertificate) |
| 268 { | 268 { |
| 269 // From https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e
ncrypted-media.html#dom-setservercertificate: | 269 // From https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e
ncrypted-media.html#dom-setservercertificate: |
| 270 // The setServerCertificate(serverCertificate) method provides a server | 270 // The setServerCertificate(serverCertificate) method provides a server |
| 271 // certificate to be used to encrypt messages to the license server. | 271 // certificate to be used to encrypt messages to the license server. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 void MediaKeys::contextDestroyed() | 359 void MediaKeys::contextDestroyed() |
| 360 { | 360 { |
| 361 ContextLifecycleObserver::contextDestroyed(); | 361 ContextLifecycleObserver::contextDestroyed(); |
| 362 | 362 |
| 363 // We don't need the CDM anymore. | 363 // We don't need the CDM anymore. |
| 364 m_cdm.clear(); | 364 m_cdm.clear(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 } // namespace blink | 367 } // namespace blink |
| OLD | NEW |