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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
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/MediaKeySession.h" | 27 #include "modules/encryptedmedia/MediaKeySession.h" |
28 | 28 |
29 #include "bindings/v8/ExceptionState.h" | |
30 #include "core/dom/Event.h" | 29 #include "core/dom/Event.h" |
31 #include "core/dom/ExceptionCode.h" | |
32 #include "core/dom/GenericEventQueue.h" | 30 #include "core/dom/GenericEventQueue.h" |
33 #include "core/html/MediaKeyError.h" | 31 #include "core/html/MediaKeyError.h" |
34 #include "core/platform/graphics/ContentDecryptionModule.h" | 32 #include "core/platform/graphics/ContentDecryptionModule.h" |
35 #include "modules/encryptedmedia/MediaKeyMessageEvent.h" | 33 #include "modules/encryptedmedia/MediaKeyMessageEvent.h" |
36 #include "modules/encryptedmedia/MediaKeys.h" | 34 #include "modules/encryptedmedia/MediaKeys.h" |
37 | 35 |
38 namespace WebCore { | 36 namespace WebCore { |
39 | 37 |
40 PassRefPtr<MediaKeySession> MediaKeySession::create(ScriptExecutionContext* cont
ext, ContentDecryptionModule* cdm, MediaKeys* keys) | 38 PassRefPtr<MediaKeySession> MediaKeySession::create(ScriptExecutionContext* cont
ext, ContentDecryptionModule* cdm, MediaKeys* keys) |
41 { | 39 { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // The user agent will asynchronously execute the following steps in the
task: | 101 // The user agent will asynchronously execute the following steps in the
task: |
104 | 102 |
105 // 1. Let cdm be the cdm loaded in the MediaKeys constructor. | 103 // 1. Let cdm be the cdm loaded in the MediaKeys constructor. |
106 // 2. Let destinationURL be null. | 104 // 2. Let destinationURL be null. |
107 | 105 |
108 // 3. Use cdm to generate a key request and follow the steps for the fir
st matching condition from the following list: | 106 // 3. Use cdm to generate a key request and follow the steps for the fir
st matching condition from the following list: |
109 m_session->generateKeyRequest(request.mimeType, *request.initData); | 107 m_session->generateKeyRequest(request.mimeType, *request.initData); |
110 } | 108 } |
111 } | 109 } |
112 | 110 |
113 void MediaKeySession::update(Uint8Array* key, ExceptionState& es) | 111 void MediaKeySession::update(Uint8Array* key, ExceptionCode& ec) |
114 { | 112 { |
115 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e
ncrypted-media.html#dom-addkey>: | 113 // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/e
ncrypted-media.html#dom-addkey>: |
116 // The addKey(key) method must run the following steps: | 114 // The addKey(key) method must run the following steps: |
117 // 1. If the first or second argument [sic] is null or an empty array, throw
an InvalidAccessError. | 115 // 1. If the first or second argument [sic] is null or an empty array, throw
an InvalidAccessError. |
118 // NOTE: the reference to a "second argument" is a spec bug. | 116 // NOTE: the reference to a "second argument" is a spec bug. |
119 if (!key || !key->length()) { | 117 if (!key || !key->length()) { |
120 es.throwDOMException(InvalidAccessError); | 118 ec = InvalidAccessError; |
121 return; | 119 return; |
122 } | 120 } |
123 | 121 |
124 // 2. Schedule a task to handle the call, providing key. | 122 // 2. Schedule a task to handle the call, providing key. |
125 m_pendingKeys.append(key); | 123 m_pendingKeys.append(key); |
126 m_addKeyTimer.startOneShot(0); | 124 m_addKeyTimer.startOneShot(0); |
127 } | 125 } |
128 | 126 |
129 void MediaKeySession::addKeyTimerFired(Timer<MediaKeySession>*) | 127 void MediaKeySession::addKeyTimerFired(Timer<MediaKeySession>*) |
130 { | 128 { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 { | 195 { |
198 return eventNames().interfaceForMediaKeySession; | 196 return eventNames().interfaceForMediaKeySession; |
199 } | 197 } |
200 | 198 |
201 ScriptExecutionContext* MediaKeySession::scriptExecutionContext() const | 199 ScriptExecutionContext* MediaKeySession::scriptExecutionContext() const |
202 { | 200 { |
203 return ContextLifecycleObserver::scriptExecutionContext(); | 201 return ContextLifecycleObserver::scriptExecutionContext(); |
204 } | 202 } |
205 | 203 |
206 } | 204 } |
OLD | NEW |