OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webencryptedmediaclient_impl.h" | 5 #include "media/blink/webencryptedmediaclient_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/memory/ptr_util.h" |
10 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "media/base/key_systems.h" | 14 #include "media/base/key_systems.h" |
14 #include "media/base/media_client.h" | 15 #include "media/base/media_client.h" |
15 #include "media/base/media_permission.h" | 16 #include "media/base/media_permission.h" |
16 #include "media/blink/webcontentdecryptionmodule_impl.h" | 17 #include "media/blink/webcontentdecryptionmodule_impl.h" |
17 #include "media/blink/webcontentdecryptionmoduleaccess_impl.h" | 18 #include "media/blink/webcontentdecryptionmoduleaccess_impl.h" |
18 #include "third_party/WebKit/public/platform/URLConversion.h" | 19 #include "third_party/WebKit/public/platform/URLConversion.h" |
19 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 20 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 base::Bind(&WebEncryptedMediaClientImpl::OnRequestSucceeded, | 119 base::Bind(&WebEncryptedMediaClientImpl::OnRequestSucceeded, |
119 weak_factory_.GetWeakPtr(), request), | 120 weak_factory_.GetWeakPtr(), request), |
120 base::Bind(&WebEncryptedMediaClientImpl::OnRequestNotSupported, | 121 base::Bind(&WebEncryptedMediaClientImpl::OnRequestNotSupported, |
121 weak_factory_.GetWeakPtr(), request)); | 122 weak_factory_.GetWeakPtr(), request)); |
122 } | 123 } |
123 | 124 |
124 void WebEncryptedMediaClientImpl::CreateCdm( | 125 void WebEncryptedMediaClientImpl::CreateCdm( |
125 const blink::WebString& key_system, | 126 const blink::WebString& key_system, |
126 const blink::WebSecurityOrigin& security_origin, | 127 const blink::WebSecurityOrigin& security_origin, |
127 const CdmConfig& cdm_config, | 128 const CdmConfig& cdm_config, |
128 scoped_ptr<blink::WebContentDecryptionModuleResult> result) { | 129 std::unique_ptr<blink::WebContentDecryptionModuleResult> result) { |
129 WebContentDecryptionModuleImpl::Create( | 130 WebContentDecryptionModuleImpl::Create( |
130 cdm_factory_, key_system, security_origin, cdm_config, std::move(result)); | 131 cdm_factory_, key_system, security_origin, cdm_config, std::move(result)); |
131 } | 132 } |
132 | 133 |
133 void WebEncryptedMediaClientImpl::OnRequestSucceeded( | 134 void WebEncryptedMediaClientImpl::OnRequestSucceeded( |
134 blink::WebEncryptedMediaRequest request, | 135 blink::WebEncryptedMediaRequest request, |
135 const blink::WebMediaKeySystemConfiguration& accumulated_configuration, | 136 const blink::WebMediaKeySystemConfiguration& accumulated_configuration, |
136 const CdmConfig& cdm_config) { | 137 const CdmConfig& cdm_config) { |
137 GetReporter(request.keySystem())->ReportSupported(); | 138 GetReporter(request.keySystem())->ReportSupported(); |
138 // TODO(sandersd): Pass |are_secure_codecs_required| along and use it to | 139 // TODO(sandersd): Pass |are_secure_codecs_required| along and use it to |
(...skipping 15 matching lines...) Expand all Loading... |
154 // TODO(sandersd): Avoid doing ASCII conversion more than once. | 155 // TODO(sandersd): Avoid doing ASCII conversion more than once. |
155 std::string key_system_ascii; | 156 std::string key_system_ascii; |
156 if (base::IsStringASCII(key_system)) | 157 if (base::IsStringASCII(key_system)) |
157 key_system_ascii = base::UTF16ToASCII(base::StringPiece16(key_system)); | 158 key_system_ascii = base::UTF16ToASCII(base::StringPiece16(key_system)); |
158 | 159 |
159 // Return a per-frame singleton so that UMA reports will be once-per-frame. | 160 // Return a per-frame singleton so that UMA reports will be once-per-frame. |
160 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); | 161 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); |
161 Reporter* reporter = reporters_.get(uma_name); | 162 Reporter* reporter = reporters_.get(uma_name); |
162 if (!reporter) { | 163 if (!reporter) { |
163 reporter = new Reporter(uma_name); | 164 reporter = new Reporter(uma_name); |
164 reporters_.add(uma_name, make_scoped_ptr(reporter)); | 165 reporters_.add(uma_name, base::WrapUnique(reporter)); |
165 } | 166 } |
166 return reporter; | 167 return reporter; |
167 } | 168 } |
168 | 169 |
169 } // namespace media | 170 } // namespace media |
OLD | NEW |