OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webcontentdecryptionmoduleaccess_impl.h" | 5 #include "webcontentdecryptionmoduleaccess_impl.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
11 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 11 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
12 #include "webcontentdecryptionmodule_impl.h" | 12 #include "webcontentdecryptionmodule_impl.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 // The caller owns the created cdm (passed back using |result|). | 16 // The caller owns the created cdm (passed back using |result|). |
17 static void CreateCdm(CdmFactory* cdm_factory, | 17 static void CreateCdm(CdmFactory* cdm_factory, |
18 blink::WebSecurityOrigin security_origin, | 18 blink::WebSecurityOrigin security_origin, |
19 blink::WebString key_system, | 19 blink::WebString key_system, |
20 blink::WebContentDecryptionModuleResult result) { | 20 blink::WebContentDecryptionModuleResult result) { |
21 WebContentDecryptionModuleImpl::Create(cdm_factory, security_origin, | 21 WebContentDecryptionModuleImpl::Create(cdm_factory, security_origin, |
22 key_system, result); | 22 key_system, result); |
23 } | 23 } |
24 | 24 |
25 WebContentDecryptionModuleAccessImpl* | 25 WebContentDecryptionModuleAccessImpl* |
26 WebContentDecryptionModuleAccessImpl::Create( | 26 WebContentDecryptionModuleAccessImpl::Create( |
27 const blink::WebString& key_system, | 27 const blink::WebString& key_system, |
| 28 const blink::WebMediaKeySystemConfiguration& configuration, |
28 const blink::WebSecurityOrigin& security_origin, | 29 const blink::WebSecurityOrigin& security_origin, |
29 CdmFactory* cdm_factory) { | 30 CdmFactory* cdm_factory) { |
30 return new WebContentDecryptionModuleAccessImpl(key_system, security_origin, | 31 return new WebContentDecryptionModuleAccessImpl(key_system, configuration, |
31 cdm_factory); | 32 security_origin, cdm_factory); |
32 } | 33 } |
33 | 34 |
34 WebContentDecryptionModuleAccessImpl::WebContentDecryptionModuleAccessImpl( | 35 WebContentDecryptionModuleAccessImpl::WebContentDecryptionModuleAccessImpl( |
35 const blink::WebString& key_system, | 36 const blink::WebString& key_system, |
| 37 const blink::WebMediaKeySystemConfiguration& configuration, |
36 const blink::WebSecurityOrigin& security_origin, | 38 const blink::WebSecurityOrigin& security_origin, |
37 CdmFactory* cdm_factory) | 39 CdmFactory* cdm_factory) |
38 : key_system_(key_system), | 40 : key_system_(key_system), |
| 41 configuration_(configuration), |
39 security_origin_(security_origin), | 42 security_origin_(security_origin), |
40 cdm_factory_(cdm_factory) { | 43 cdm_factory_(cdm_factory) { |
41 } | 44 } |
42 | 45 |
43 WebContentDecryptionModuleAccessImpl::~WebContentDecryptionModuleAccessImpl() { | 46 WebContentDecryptionModuleAccessImpl::~WebContentDecryptionModuleAccessImpl() { |
44 } | 47 } |
45 | 48 |
| 49 blink::WebMediaKeySystemConfiguration |
| 50 WebContentDecryptionModuleAccessImpl::getConfiguration() { |
| 51 return configuration_; |
| 52 } |
| 53 |
46 void WebContentDecryptionModuleAccessImpl::createContentDecryptionModule( | 54 void WebContentDecryptionModuleAccessImpl::createContentDecryptionModule( |
47 blink::WebContentDecryptionModuleResult result) { | 55 blink::WebContentDecryptionModuleResult result) { |
48 // This method needs to run asynchronously, as it may need to load the CDM. | 56 // This method needs to run asynchronously, as it may need to load the CDM. |
49 // As this object's lifetime is controlled by MediaKeySystemAccess on the | 57 // As this object's lifetime is controlled by MediaKeySystemAccess on the |
50 // blink side, copy all values needed by CreateCdm() in case the blink object | 58 // blink side, copy all values needed by CreateCdm() in case the blink object |
51 // gets garbage-collected. | 59 // gets garbage-collected. |
52 base::MessageLoopProxy::current()->PostTask( | 60 base::MessageLoopProxy::current()->PostTask( |
53 FROM_HERE, base::Bind(&CreateCdm, cdm_factory_, security_origin_, | 61 FROM_HERE, base::Bind(&CreateCdm, cdm_factory_, security_origin_, |
54 key_system_, result)); | 62 key_system_, result)); |
55 } | 63 } |
56 | 64 |
57 } // namespace media | 65 } // namespace media |
OLD | NEW |