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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 { | 122 { |
123 WTF_LOG(Media, "MediaKeysInitializer::timerFired"); | 123 WTF_LOG(Media, "MediaKeysInitializer::timerFired"); |
124 | 124 |
125 // NOTE: Continued from step 4. of MediaKeys::create(). | 125 // NOTE: Continued from step 4. of MediaKeys::create(). |
126 // 4.1 Let cdm be the content decryption module corresponding to | 126 // 4.1 Let cdm be the content decryption module corresponding to |
127 // keySystem. | 127 // keySystem. |
128 // 4.2 Load and initialize the cdm if necessary. | 128 // 4.2 Load and initialize the cdm if necessary. |
129 Document* document = toDocument(executionContext()); | 129 Document* document = toDocument(executionContext()); |
130 MediaKeysController* controller = MediaKeysController::from(document->page()
); | 130 MediaKeysController* controller = MediaKeysController::from(document->page()
); |
131 // FIXME: make createContentDecryptionModule() asynchronous. | 131 // FIXME: make createContentDecryptionModule() asynchronous. |
132 OwnPtr<blink::WebContentDecryptionModule> cdm = controller->createContentDec
ryptionModule(executionContext(), m_keySystem); | 132 OwnPtr<WebContentDecryptionModule> cdm = controller->createContentDecryption
Module(executionContext(), m_keySystem); |
133 | 133 |
134 // 4.3 If cdm fails to load or initialize, reject promise with a new | 134 // 4.3 If cdm fails to load or initialize, reject promise with a new |
135 // DOMException whose name is the appropriate error name and that | 135 // DOMException whose name is the appropriate error name and that |
136 // has an appropriate message. | 136 // has an appropriate message. |
137 if (!cdm) { | 137 if (!cdm) { |
138 String message("A content decryption module could not be loaded for the
'" + m_keySystem + "' key system."); | 138 String message("A content decryption module could not be loaded for the
'" + m_keySystem + "' key system."); |
139 reject(DOMException::create(UnknownError, message)); | 139 reject(DOMException::create(UnknownError, message)); |
140 return; | 140 return; |
141 } | 141 } |
142 | 142 |
(...skipping 30 matching lines...) Expand all Loading... |
173 // String message("The key system '" + keySystem + "' is not supported."
); | 173 // String message("The key system '" + keySystem + "' is not supported."
); |
174 return createRejectedPromise(scriptState, NotSupportedError, "The key sy
stem '" + keySystem + "' is not supported."); | 174 return createRejectedPromise(scriptState, NotSupportedError, "The key sy
stem '" + keySystem + "' is not supported."); |
175 } | 175 } |
176 | 176 |
177 // 3. Let promise be a new promise. | 177 // 3. Let promise be a new promise. |
178 // 4. Asynchronously create and initialize the MediaKeys. | 178 // 4. Asynchronously create and initialize the MediaKeys. |
179 // 5. Return promise. | 179 // 5. Return promise. |
180 return MediaKeysInitializer::create(scriptState, keySystem); | 180 return MediaKeysInitializer::create(scriptState, keySystem); |
181 } | 181 } |
182 | 182 |
183 MediaKeys::MediaKeys(ExecutionContext* context, const String& keySystem, PassOwn
Ptr<blink::WebContentDecryptionModule> cdm) | 183 MediaKeys::MediaKeys(ExecutionContext* context, const String& keySystem, PassOwn
Ptr<WebContentDecryptionModule> cdm) |
184 : ContextLifecycleObserver(context) | 184 : ContextLifecycleObserver(context) |
185 , m_keySystem(keySystem) | 185 , m_keySystem(keySystem) |
186 , m_cdm(cdm) | 186 , m_cdm(cdm) |
187 { | 187 { |
188 WTF_LOG(Media, "MediaKeys(%p)::MediaKeys", this); | 188 WTF_LOG(Media, "MediaKeys(%p)::MediaKeys", this); |
189 ScriptWrappable::init(this); | 189 ScriptWrappable::init(this); |
190 | 190 |
191 // Step 4.4 of MediaKeys::create(): | 191 // Step 4.4 of MediaKeys::create(): |
192 // 4.4.1 Set the keySystem attribute to keySystem. | 192 // 4.4.1 Set the keySystem attribute to keySystem. |
193 ASSERT(!m_keySystem.isEmpty()); | 193 ASSERT(!m_keySystem.isEmpty()); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 // 3. If contentType is an empty string, return true and abort these steps. | 269 // 3. If contentType is an empty string, return true and abort these steps. |
270 if (contentType.isEmpty()) | 270 if (contentType.isEmpty()) |
271 return true; | 271 return true; |
272 | 272 |
273 // 4. If the Key System specified by keySystem does not support decrypting t
he container and/or | 273 // 4. If the Key System specified by keySystem does not support decrypting t
he container and/or |
274 // codec specified by contentType, return false and abort these steps. | 274 // codec specified by contentType, return false and abort these steps. |
275 return isKeySystemSupportedWithContentType(keySystem, contentType); | 275 return isKeySystemSupportedWithContentType(keySystem, contentType); |
276 } | 276 } |
277 | 277 |
278 blink::WebContentDecryptionModule* MediaKeys::contentDecryptionModule() | 278 WebContentDecryptionModule* MediaKeys::contentDecryptionModule() |
279 { | 279 { |
280 return m_cdm.get(); | 280 return m_cdm.get(); |
281 } | 281 } |
282 | 282 |
283 void MediaKeys::trace(Visitor* visitor) | 283 void MediaKeys::trace(Visitor* visitor) |
284 { | 284 { |
285 } | 285 } |
286 | 286 |
287 void MediaKeys::contextDestroyed() | 287 void MediaKeys::contextDestroyed() |
288 { | 288 { |
289 ContextLifecycleObserver::contextDestroyed(); | 289 ContextLifecycleObserver::contextDestroyed(); |
290 | 290 |
291 // We don't need the CDM anymore. | 291 // We don't need the CDM anymore. |
292 m_cdm.clear(); | 292 m_cdm.clear(); |
293 } | 293 } |
294 | 294 |
295 } | 295 } // namespace blink |
OLD | NEW |