OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
13 * distribution. | 13 * distribution. |
14 * * Neither the name of Google Inc. nor the names of its | 14 * * Neither the name of Google Inc. nor the names of its |
15 * contributors may be used to endorse or promote products derived from | 15 * contributors may be used to endorse or promote products derived from |
16 * this software without specific prior written permission. | 16 * this software without specific prior written permission. |
17 * | 17 * |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 | 32 #include "core/platform/graphics/ContentDecryptionModuleSession.h" |
33 #include "core/platform/network/BlobRegistryProxy.h" | |
34 | 33 |
35 #include "core/platform/KURL.h" | 34 #include "core/platform/KURL.h" |
36 #include "core/platform/network/BlobData.h" | 35 #include "core/platform/NotImplemented.h" |
37 #include "public/platform/Platform.h" | 36 #include "public/platform/Platform.h" |
38 #include "public/platform/WebBlobData.h" | 37 #include "public/platform/WebContentDecryptionModule.h" |
39 #include "public/platform/WebBlobRegistry.h" | |
40 #include "public/platform/WebURL.h" | 38 #include "public/platform/WebURL.h" |
41 #include <wtf/MainThread.h> | 39 #include "wtf/Uint8Array.h" |
42 #include <wtf/StdLibExtras.h> | |
43 | 40 |
44 namespace WebCore { | 41 namespace WebCore { |
45 | 42 |
46 BlobRegistry& blobRegistry() | 43 ContentDecryptionModuleSession::ContentDecryptionModuleSession(WebKit::WebConten tDecryptionModule& ContentDecryptionModule, ContentDecryptionModuleSessionClient * client) |
abarth-chromium
2013/06/12 23:03:51
WebKit::WebContentDecryptionModule& -> WebKit:
ddorwin
2013/06/12 23:55:54
Done. I was trying to avoid calling leakPtr() at t
| |
44 : m_client(client) | |
47 { | 45 { |
48 ASSERT(isMainThread()); | 46 m_session = adoptPtr(ContentDecryptionModule.createSession(this)); |
49 DEFINE_STATIC_LOCAL(BlobRegistryProxy, instance, ()); | 47 ASSERT(m_session); |
50 return instance; | |
51 } | 48 } |
52 | 49 |
53 BlobRegistryProxy::BlobRegistryProxy() | 50 ContentDecryptionModuleSession::~ContentDecryptionModuleSession() |
54 : m_webBlobRegistry(WebKit::Platform::current()->blobRegistry()) | |
55 { | 51 { |
56 } | 52 } |
57 | 53 |
58 void BlobRegistryProxy::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> bl obData) | 54 String ContentDecryptionModuleSession::sessionId() const |
59 { | 55 { |
60 if (m_webBlobRegistry) { | 56 return m_session->sessionId(); |
61 WebKit::WebBlobData webBlobData(blobData); | |
62 m_webBlobRegistry->registerBlobURL(url, webBlobData); | |
63 } | |
64 } | 57 } |
65 | 58 |
66 void BlobRegistryProxy::registerBlobURL(const KURL& url, const KURL& srcURL) | 59 void ContentDecryptionModuleSession::generateKeyRequest(const String& mimeType, const Uint8Array& initData) |
67 { | 60 { |
68 if (m_webBlobRegistry) | 61 m_session->generateKeyRequest(mimeType, initData.data(), initData.length()); |
69 m_webBlobRegistry->registerBlobURL(url, srcURL); | |
70 } | 62 } |
71 | 63 |
72 void BlobRegistryProxy::unregisterBlobURL(const KURL& url) | 64 void ContentDecryptionModuleSession::update(const Uint8Array& key) |
73 { | 65 { |
74 if (m_webBlobRegistry) | 66 m_session->update(key.data(), key.length()); |
75 m_webBlobRegistry->unregisterBlobURL(url); | 67 } |
68 | |
69 void ContentDecryptionModuleSession::close() | |
70 { | |
71 m_session->close(); | |
72 } | |
73 | |
74 void ContentDecryptionModuleSession::keyAdded() | |
75 { | |
76 m_client->keyAdded(); | |
77 } | |
78 | |
79 void ContentDecryptionModuleSession::keyError(MediaKeyErrorCode errorCode, unsig ned long systemCode) | |
80 { | |
81 m_client->keyError(static_cast<ContentDecryptionModuleSessionClient::MediaKe yErrorCode>(errorCode), systemCode); | |
82 } | |
83 | |
84 void ContentDecryptionModuleSession::keyMessage(const unsigned char* message, si ze_t messageLength, const WebKit::WebURL& destinationURL) | |
85 { | |
86 m_client->keyMessage(message, messageLength, destinationURL); | |
76 } | 87 } |
77 | 88 |
78 } // namespace WebCore | 89 } // namespace WebCore |
OLD | NEW |