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 28 matching lines...) Expand all Loading... |
39 #include "platform/Logging.h" | 39 #include "platform/Logging.h" |
40 #include "platform/MIMETypeRegistry.h" | 40 #include "platform/MIMETypeRegistry.h" |
41 #include "platform/Timer.h" | 41 #include "platform/Timer.h" |
42 #include "platform/UUID.h" | 42 #include "platform/UUID.h" |
43 #include "public/platform/Platform.h" | 43 #include "public/platform/Platform.h" |
44 #include "public/platform/WebContentDecryptionModule.h" | 44 #include "public/platform/WebContentDecryptionModule.h" |
45 #include "wtf/ArrayBuffer.h" | 45 #include "wtf/ArrayBuffer.h" |
46 #include "wtf/ArrayBufferView.h" | 46 #include "wtf/ArrayBufferView.h" |
47 #include "wtf/RefPtr.h" | 47 #include "wtf/RefPtr.h" |
48 | 48 |
49 #if ENABLE(ASSERT) | |
50 namespace { | |
51 | |
52 // The list of possible values for |sessionType| passed to createSession(). | |
53 const char* kTemporary = "temporary"; | |
54 const char* kPersistent = "persistent"; | |
55 | |
56 } // namespace | |
57 #endif | |
58 | |
59 namespace blink { | 49 namespace blink { |
60 | 50 |
61 static bool isKeySystemSupportedWithContentType(const String& keySystem, const S
tring& contentType) | 51 static bool isKeySystemSupportedWithContentType(const String& keySystem, const S
tring& contentType) |
62 { | 52 { |
63 ASSERT(!keySystem.isEmpty()); | 53 ASSERT(!keySystem.isEmpty()); |
64 | 54 |
65 ContentType type(contentType); | 55 ContentType type(contentType); |
66 String codecs = type.parameter("codecs"); | 56 String codecs = type.parameter("codecs"); |
67 return MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(keySystem, type.t
ype(), codecs); | 57 return MIMETypeRegistry::isSupportedEncryptedMediaMIMEType(keySystem, type.t
ype(), codecs); |
68 } | 58 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 { | 184 { |
195 WTF_LOG(Media, "MediaKeys(%p)::createSession", this); | 185 WTF_LOG(Media, "MediaKeys(%p)::createSession", this); |
196 | 186 |
197 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e
ncrypted-media.html#dom-createsession>: | 187 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e
ncrypted-media.html#dom-createsession>: |
198 // The createSession(sessionType) method returns a new MediaKeySession | 188 // The createSession(sessionType) method returns a new MediaKeySession |
199 // object. It must run the following steps: | 189 // object. It must run the following steps: |
200 // 1. If sessionType is not supported by the content decryption module | 190 // 1. If sessionType is not supported by the content decryption module |
201 // corresponding to the keySystem, throw a DOMException whose name is | 191 // corresponding to the keySystem, throw a DOMException whose name is |
202 // "NotSupportedError". | 192 // "NotSupportedError". |
203 // FIXME: Check whether sessionType is actually supported by the CDM. | 193 // FIXME: Check whether sessionType is actually supported by the CDM. |
204 ASSERT(sessionType == kTemporary || sessionType == kPersistent); | 194 ASSERT(MediaKeySession::isValidSessionType(sessionType)); |
205 | 195 |
206 // 2. Let session be a new MediaKeySession object, and initialize it as | 196 // 2. Let session be a new MediaKeySession object, and initialize it as |
207 // follows: | 197 // follows: |
208 // (Initialization is performed in the constructor.) | 198 // (Initialization is performed in the constructor.) |
209 // 3. Return session. | 199 // 3. Return session. |
210 return MediaKeySession::create(scriptState, this, sessionType); | 200 return MediaKeySession::create(scriptState, this, sessionType); |
211 } | 201 } |
212 | 202 |
213 bool MediaKeys::isTypeSupported(const String& keySystem, const String& contentTy
pe) | 203 bool MediaKeys::isTypeSupported(const String& keySystem, const String& contentTy
pe) |
214 { | 204 { |
(...skipping 28 matching lines...) Expand all Loading... |
243 | 233 |
244 void MediaKeys::contextDestroyed() | 234 void MediaKeys::contextDestroyed() |
245 { | 235 { |
246 ContextLifecycleObserver::contextDestroyed(); | 236 ContextLifecycleObserver::contextDestroyed(); |
247 | 237 |
248 // We don't need the CDM anymore. | 238 // We don't need the CDM anymore. |
249 m_cdm.clear(); | 239 m_cdm.clear(); |
250 } | 240 } |
251 | 241 |
252 } // namespace blink | 242 } // namespace blink |
OLD | NEW |