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 "media/blink/webcontentdecryptionmodule_impl.h" | 5 #include "media/blink/webcontentdecryptionmodule_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "third_party/WebKit/public/platform/WebString.h" | 22 #include "third_party/WebKit/public/platform/WebString.h" |
23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
24 | 24 |
25 namespace media { | 25 namespace media { |
26 | 26 |
27 void WebContentDecryptionModuleImpl::Create( | 27 void WebContentDecryptionModuleImpl::Create( |
28 media::CdmFactory* cdm_factory, | 28 media::CdmFactory* cdm_factory, |
29 const base::string16& key_system, | 29 const base::string16& key_system, |
30 const blink::WebSecurityOrigin& security_origin, | 30 const blink::WebSecurityOrigin& security_origin, |
31 const CdmConfig& cdm_config, | 31 const CdmConfig& cdm_config, |
32 scoped_ptr<blink::WebContentDecryptionModuleResult> result) { | 32 std::unique_ptr<blink::WebContentDecryptionModuleResult> result) { |
33 DCHECK(!security_origin.isNull()); | 33 DCHECK(!security_origin.isNull()); |
34 DCHECK(!key_system.empty()); | 34 DCHECK(!key_system.empty()); |
35 | 35 |
36 // TODO(ddorwin): Guard against this in supported types check and remove this. | 36 // TODO(ddorwin): Guard against this in supported types check and remove this. |
37 // Chromium only supports ASCII key systems. | 37 // Chromium only supports ASCII key systems. |
38 if (!base::IsStringASCII(key_system)) { | 38 if (!base::IsStringASCII(key_system)) { |
39 NOTREACHED(); | 39 NOTREACHED(); |
40 result->completeWithError( | 40 result->completeWithError( |
41 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, | 41 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, |
42 "Invalid keysystem."); | 42 "Invalid keysystem."); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 void WebContentDecryptionModuleImpl::setServerCertificate( | 92 void WebContentDecryptionModuleImpl::setServerCertificate( |
93 const uint8_t* server_certificate, | 93 const uint8_t* server_certificate, |
94 size_t server_certificate_length, | 94 size_t server_certificate_length, |
95 blink::WebContentDecryptionModuleResult result) { | 95 blink::WebContentDecryptionModuleResult result) { |
96 DCHECK(server_certificate); | 96 DCHECK(server_certificate); |
97 adapter_->SetServerCertificate( | 97 adapter_->SetServerCertificate( |
98 std::vector<uint8_t>(server_certificate, | 98 std::vector<uint8_t>(server_certificate, |
99 server_certificate + server_certificate_length), | 99 server_certificate + server_certificate_length), |
100 scoped_ptr<SimpleCdmPromise>( | 100 std::unique_ptr<SimpleCdmPromise>( |
101 new CdmResultPromise<>(result, std::string()))); | 101 new CdmResultPromise<>(result, std::string()))); |
102 } | 102 } |
103 | 103 |
104 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() { | 104 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() { |
105 return adapter_->GetCdmContext(); | 105 return adapter_->GetCdmContext(); |
106 } | 106 } |
107 | 107 |
108 } // namespace media | 108 } // namespace media |
OLD | NEW |