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 29 matching lines...) Expand all Loading... |
40 #include "platform/Logging.h" | 40 #include "platform/Logging.h" |
41 #include "platform/MIMETypeRegistry.h" | 41 #include "platform/MIMETypeRegistry.h" |
42 #include "platform/Timer.h" | 42 #include "platform/Timer.h" |
43 #include "platform/UUID.h" | 43 #include "platform/UUID.h" |
44 #include "public/platform/Platform.h" | 44 #include "public/platform/Platform.h" |
45 #include "public/platform/WebContentDecryptionModule.h" | 45 #include "public/platform/WebContentDecryptionModule.h" |
46 #include "wtf/ArrayBuffer.h" | 46 #include "wtf/ArrayBuffer.h" |
47 #include "wtf/ArrayBufferView.h" | 47 #include "wtf/ArrayBufferView.h" |
48 #include "wtf/RefPtr.h" | 48 #include "wtf/RefPtr.h" |
49 | 49 |
50 #if ENABLE(ASSERT) | |
51 namespace { | |
52 | |
53 // The list of possible values for |sessionType| passed to createSession(). | |
54 const char* kTemporary = "temporary"; | |
55 const char* kPersistent = "persistent"; | |
56 | |
57 } // namespace | |
58 #endif | |
59 | |
60 namespace blink { | 50 namespace blink { |
61 | 51 |
62 static bool isKeySystemSupportedWithContentType(const String& keySystem, const S
tring& contentType) | 52 static bool isKeySystemSupportedWithContentType(const String& keySystem, const S
tring& contentType) |
63 { | 53 { |
64 ASSERT(!keySystem.isEmpty()); | 54 ASSERT(!keySystem.isEmpty()); |
65 | 55 |
66 ContentType type(contentType); | 56 ContentType type(contentType); |
67 String codecs = type.parameter("codecs"); | 57 String codecs = type.parameter("codecs"); |
68 return MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(keySystem, type.t
ype(), codecs); | 58 return MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(keySystem, type.t
ype(), codecs); |
69 } | 59 } |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 { | 226 { |
237 WTF_LOG(Media, "MediaKeys(%p)::createSession", this); | 227 WTF_LOG(Media, "MediaKeys(%p)::createSession", this); |
238 | 228 |
239 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e
ncrypted-media.html#dom-createsession>: | 229 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e
ncrypted-media.html#dom-createsession>: |
240 // The createSession(sessionType) method returns a new MediaKeySession | 230 // The createSession(sessionType) method returns a new MediaKeySession |
241 // object. It must run the following steps: | 231 // object. It must run the following steps: |
242 // 1. If sessionType is not supported by the content decryption module | 232 // 1. If sessionType is not supported by the content decryption module |
243 // corresponding to the keySystem, throw a DOMException whose name is | 233 // corresponding to the keySystem, throw a DOMException whose name is |
244 // "NotSupportedError". | 234 // "NotSupportedError". |
245 // FIXME: Check whether sessionType is actually supported by the CDM. | 235 // FIXME: Check whether sessionType is actually supported by the CDM. |
246 ASSERT(sessionType == kTemporary || sessionType == kPersistent); | 236 ASSERT(MediaKeySession::isValidSessionType(sessionType)); |
247 | 237 |
248 // 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 |
249 // follows: | 239 // follows: |
250 // (Initialization is performed in the constructor.) | 240 // (Initialization is performed in the constructor.) |
251 // 3. Return session. | 241 // 3. Return session. |
252 return MediaKeySession::create(scriptState, this, sessionType); | 242 return MediaKeySession::create(scriptState, this, sessionType); |
253 } | 243 } |
254 | 244 |
255 ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, ArrayBuf
fer* serverCertificate) | 245 ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, ArrayBuf
fer* serverCertificate) |
256 { | 246 { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 348 |
359 void MediaKeys::contextDestroyed() | 349 void MediaKeys::contextDestroyed() |
360 { | 350 { |
361 ContextLifecycleObserver::contextDestroyed(); | 351 ContextLifecycleObserver::contextDestroyed(); |
362 | 352 |
363 // We don't need the CDM anymore. | 353 // We don't need the CDM anymore. |
364 m_cdm.clear(); | 354 m_cdm.clear(); |
365 } | 355 } |
366 | 356 |
367 } // namespace blink | 357 } // namespace blink |
OLD | NEW |