Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: media/blink/webencryptedmediaclient_impl.cc

Issue 923283002: Implement checks for distinctiveIdentifier and persistentState in requestMediaKeySystemAccess(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove Blink dependency again. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/key_systems_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "webencryptedmediaclient_impl.h" 5 #include "webencryptedmediaclient_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 10 matching lines...) Expand all
21 namespace media { 21 namespace media {
22 22
23 // These names are used by UMA. 23 // These names are used by UMA.
24 const char kKeySystemSupportUMAPrefix[] = 24 const char kKeySystemSupportUMAPrefix[] =
25 "Media.EME.RequestMediaKeySystemAccess."; 25 "Media.EME.RequestMediaKeySystemAccess.";
26 26
27 static bool IsSupportedContentType( 27 static bool IsSupportedContentType(
28 const std::string& key_system, 28 const std::string& key_system,
29 const std::string& mime_type, 29 const std::string& mime_type,
30 const std::string& codecs) { 30 const std::string& codecs) {
31 // Per RFC 6838, "Both top-level type and subtype names are case-insensitive." 31 // TODO(sandersd): Move contentType parsing from Blink to here so that invalid
32 // TODO(sandersd): Check that |container| matches the capability: 32 // parameters can be rejected. http://crbug.com/417561
33 // - audioCapabilitys: audio/mp4 or audio/webm. 33 // TODO(sandersd): Pass in the media type (audio or video) and check that the
34 // - videoCapabilitys: video/mp4 or video/webm. 34 // container type matches. http://crbug.com/457384
35 // http://crbug.com/457384.
36 std::string container = base::StringToLowerASCII(mime_type); 35 std::string container = base::StringToLowerASCII(mime_type);
37 36
38 // Check that |codecs| are supported as specified (e.g. "mp4a.40.2"). 37 // Check that |codecs| are supported by the CDM. This check does not handle
38 // extended codecs, so extended codec information is stripped.
39 // TODO(sandersd): Reject codecs that do not match the media type.
40 // http://crbug.com/457386
39 std::vector<std::string> codec_vector; 41 std::vector<std::string> codec_vector;
42 net::ParseCodecString(codecs, &codec_vector, true);
43 if (!IsSupportedKeySystemWithMediaMimeType(container, codec_vector,
44 key_system)) {
45 return false;
46 }
47
48 // Check that |codecs| are supported by Chrome. This is done primarily to
49 // validate extended codecs, but it also ensures that the CDM cannot support
50 // codecs that Chrome does not (which would be bad because it would require
51 // considering the accumulated configuration, and could affect whether secure
52 // decode is required).
53 // TODO(sandersd): Reject ambiguous codecs. http://crbug.com/374751
54 codec_vector.clear();
40 net::ParseCodecString(codecs, &codec_vector, false); 55 net::ParseCodecString(codecs, &codec_vector, false);
41 if (!net::AreSupportedMediaCodecs(codec_vector)) 56 return net::AreSupportedMediaCodecs(codec_vector);
42 return false; 57 }
43 58
44 // IsSupportedKeySystemWithMediaMimeType() only works with base codecs 59 static bool GetSupportedCapabilities(
45 // (e.g. "mp4a"), so reparse |codecs| to get the base only. 60 const std::string& key_system,
46 codec_vector.clear(); 61 const blink::WebVector<blink::WebMediaKeySystemMediaCapability>&
47 net::ParseCodecString(codecs, &codec_vector, true); 62 capabilities,
48 return IsSupportedKeySystemWithMediaMimeType(container, codec_vector, 63 std::vector<blink::WebMediaKeySystemMediaCapability>*
49 key_system); 64 media_type_capabilities) {
65 // From https://w3c.github.io/encrypted-media/#get-supported-capabilities-for- media-type
66 // 1. Let accumulated capabilities be partial configuration.
67 // (Skipped as there are no configuration-based codec restrictions.)
68 // 2. Let media type capabilities be empty.
69 DCHECK_EQ(media_type_capabilities->size(), 0ul);
70 // 3. For each value in capabilities:
71 for (size_t i = 0; i < capabilities.size(); i++) {
72 // 3.1. Let contentType be the value's contentType member.
73 // 3.2. Let robustness be the value's robustness member.
74 const blink::WebMediaKeySystemMediaCapability& capability = capabilities[i];
75 // 3.3. If contentType is the empty string, return null.
76 if (capability.mimeType.isEmpty())
77 return false;
78 // 3.4-3.11. (Implemented by IsSupportedContentType().)
79 if (!base::IsStringASCII(capability.mimeType) ||
80 !base::IsStringASCII(capability.codecs) ||
81 !IsSupportedContentType(key_system,
82 base::UTF16ToASCII(capability.mimeType),
83 base::UTF16ToASCII(capability.codecs))) {
84 continue;
85 }
86 // 3.12. If robustness is not the empty string, run the following steps:
87 // (Robustness is not supported.)
88 // TODO(sandersd): Implement robustness. http://crbug.com/442586
89 if (!capability.robustness.isEmpty()) {
90 LOG(WARNING) << "Configuration rejected because rubustness strings are "
91 << "not yet supported.";
92 continue;
93 }
94 // 3.13. If the user agent and implementation do not support playback of
95 // encrypted media data as specified by configuration, including all
96 // media types, in combination with accumulated capabilities,
97 // continue to the next iteration.
98 // (Skipped as there are no configuration-based codec restrictions.)
99 // 3.14. Add configuration to media type capabilities.
100 media_type_capabilities->push_back(capability);
101 // 3.15. Add configuration to accumulated capabilities.
102 // (Skipped as there are no configuration-based codec restrictions.)
103 }
104 // 4. If media type capabilities is empty, return null.
105 // 5. Return media type capabilities.
106 return !media_type_capabilities->empty();
107 }
108
109 static EmeFeatureRequirement ConvertRequirement(
110 blink::WebMediaKeySystemConfiguration::Requirement requirement) {
111 switch (requirement) {
112 case blink::WebMediaKeySystemConfiguration::Requirement::Required:
113 return EME_FEATURE_REQUIRED;
114 case blink::WebMediaKeySystemConfiguration::Requirement::Optional:
115 return EME_FEATURE_OPTIONAL;
116 case blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed:
117 return EME_FEATURE_NOT_ALLOWED;
118 }
119
120 NOTREACHED();
121 return EME_FEATURE_NOT_ALLOWED;
50 } 122 }
51 123
52 static bool GetSupportedConfiguration( 124 static bool GetSupportedConfiguration(
53 const std::string& key_system, 125 const std::string& key_system,
54 const blink::WebMediaKeySystemConfiguration& candidate, 126 const blink::WebMediaKeySystemConfiguration& candidate,
55 const blink::WebSecurityOrigin& security_origin, 127 const blink::WebSecurityOrigin& security_origin,
56 blink::WebMediaKeySystemConfiguration* accumulated_configuration) { 128 blink::WebMediaKeySystemConfiguration* accumulated_configuration) {
129 // When determining support, assume that permission could be granted.
130 // TODO(sandersd): Set to false if the permission is rejected.
131 bool is_permission_possible = true;
132
133 // From https://w3c.github.io/encrypted-media/#get-supported-configuration
134 // 1. Let accumulated configuration be empty. (Done by caller.)
135 // 2. If candidate configuration's initDataTypes attribute is not empty, run
136 // the following steps:
57 if (!candidate.initDataTypes.isEmpty()) { 137 if (!candidate.initDataTypes.isEmpty()) {
58 std::vector<blink::WebString> init_data_types; 138 // 2.1. Let supported types be empty.
139 std::vector<blink::WebString> supported_types;
59 140
141 // 2.2. For each value in candidate configuration's initDataTypes attribute:
60 for (size_t i = 0; i < candidate.initDataTypes.size(); i++) { 142 for (size_t i = 0; i < candidate.initDataTypes.size(); i++) {
143 // 2.2.1. Let initDataType be the value.
61 const blink::WebString& init_data_type = candidate.initDataTypes[i]; 144 const blink::WebString& init_data_type = candidate.initDataTypes[i];
145 // 2.2.2. If initDataType is the empty string, return null.
62 if (init_data_type.isEmpty()) 146 if (init_data_type.isEmpty())
63 return false; 147 return false;
148 // 2.2.3. If the implementation supports generating requests based on
149 // initDataType, add initDataType to supported types. String
150 // comparison is case-sensitive.
64 if (base::IsStringASCII(init_data_type) && 151 if (base::IsStringASCII(init_data_type) &&
65 IsSupportedKeySystemWithInitDataType( 152 IsSupportedKeySystemWithInitDataType(
66 key_system, base::UTF16ToASCII(init_data_type))) { 153 key_system, base::UTF16ToASCII(init_data_type))) {
67 init_data_types.push_back(init_data_type); 154 supported_types.push_back(init_data_type);
68 } 155 }
69 } 156 }
70 157
71 if (init_data_types.empty()) 158 // 2.3. If supported types is empty, return null.
159 if (supported_types.empty())
72 return false; 160 return false;
73 161
74 accumulated_configuration->initDataTypes = init_data_types; 162 // 2.4. Add supported types to accumulated configuration.
163 accumulated_configuration->initDataTypes = supported_types;
75 } 164 }
76 165
77 // TODO(sandersd): Implement distinctiveIdentifier and persistentState checks. 166 // 3. Follow the steps for the value of candidate configuration's
78 if (candidate.distinctiveIdentifier != 167 // distinctiveIdentifier attribute from the following list:
79 blink::WebMediaKeySystemConfiguration::Requirement::Optional || 168 // - "required": If the implementation does not support a persistent
80 candidate.persistentState != 169 // Distinctive Identifier in combination with accumulated configuration,
81 blink::WebMediaKeySystemConfiguration::Requirement::Optional) { 170 // return null.
171 // - "optional": Continue.
172 // - "not-allowed": If the implementation requires a Distinctive
173 // Identifier in combination with accumulated configuration, return
174 // null.
175 EmeFeatureRequirement di_requirement =
176 ConvertRequirement(candidate.distinctiveIdentifier);
177 if (!IsDistinctiveIdentifierRequirementSupported(key_system, di_requirement,
178 is_permission_possible)) {
82 return false; 179 return false;
83 } 180 }
84 181
85 if (!candidate.audioCapabilities.isEmpty()) { 182 // 4. Add the value of the candidate configuration's distinctiveIdentifier
86 std::vector<blink::WebMediaKeySystemMediaCapability> audio_capabilities; 183 // attribute to accumulated configuration.
184 accumulated_configuration->distinctiveIdentifier =
185 candidate.distinctiveIdentifier;
87 186
88 for (size_t i = 0; i < candidate.audioCapabilities.size(); i++) { 187 // 5. Follow the steps for the value of candidate configuration's
89 const blink::WebMediaKeySystemMediaCapability& capabilities = 188 // persistentState attribute from the following list:
90 candidate.audioCapabilities[i]; 189 // - "required": If the implementation does not support persisting state
91 if (capabilities.mimeType.isEmpty()) 190 // in combination with accumulated configuration, return null.
92 return false; 191 // - "optional": Continue.
93 if (!base::IsStringASCII(capabilities.mimeType) || 192 // - "not-allowed": If the implementation requires persisting state in
94 !base::IsStringASCII(capabilities.codecs) || 193 // combination with accumulated configuration, return null.
95 !IsSupportedContentType( 194 EmeFeatureRequirement ps_requirement =
96 key_system, base::UTF16ToASCII(capabilities.mimeType), 195 ConvertRequirement(candidate.persistentState);
97 base::UTF16ToASCII(capabilities.codecs))) { 196 if (!IsPersistentStateRequirementSupported(key_system, ps_requirement,
98 continue; 197 is_permission_possible)) {
99 } 198 return false;
100 // TODO(sandersd): Support robustness. 199 }
101 if (!capabilities.robustness.isEmpty()) 200
102 continue; 201 // 6. Add the value of the candidate configuration's persistentState
103 audio_capabilities.push_back(capabilities); 202 // attribute to accumulated configuration.
203 accumulated_configuration->persistentState = candidate.persistentState;
204
205 // 7. If candidate configuration's videoCapabilities attribute is not empty,
206 // run the following steps:
207 if (!candidate.videoCapabilities.isEmpty()) {
208 // 7.1. Let video capabilities be the result of executing the Get Supported
209 // Capabilities for Media Type algorithm on Video, candidate
210 // configuration's videoCapabilities attribute, and accumulated
211 // configuration.
212 // 7.2. If video capabilities is null, return null.
213 std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities;
214 if (!GetSupportedCapabilities(key_system, candidate.videoCapabilities,
215 &video_capabilities)) {
216 return false;
104 } 217 }
105 218
106 if (audio_capabilities.empty()) 219 // 7.3. Add video capabilities to accumulated configuration.
220 accumulated_configuration->videoCapabilities = video_capabilities;
221 }
222
223 // 8. If candidate configuration's audioCapabilities attribute is not empty,
224 // run the following steps:
225 if (!candidate.audioCapabilities.isEmpty()) {
226 // 8.1. Let audio capabilities be the result of executing the Get Supported
227 // Capabilities for Media Type algorithm on Audio, candidate
228 // configuration's audioCapabilities attribute, and accumulated
229 // configuration.
230 // 8.2. If audio capabilities is null, return null.
231 std::vector<blink::WebMediaKeySystemMediaCapability> audio_capabilities;
232 if (!GetSupportedCapabilities(key_system, candidate.audioCapabilities,
233 &audio_capabilities)) {
107 return false; 234 return false;
235 }
108 236
237 // 8.3. Add audio capabilities to accumulated configuration.
109 accumulated_configuration->audioCapabilities = audio_capabilities; 238 accumulated_configuration->audioCapabilities = audio_capabilities;
110 } 239 }
111 240
112 if (!candidate.videoCapabilities.isEmpty()) { 241 // 9. If accumulated configuration's distinctiveIdentifier value is
113 std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities; 242 // "optional", follow the steps for the first matching condition from the
114 243 // following list:
115 for (size_t i = 0; i < candidate.videoCapabilities.size(); i++) { 244 // - If the implementation requires a Distinctive Identifier for any of
116 const blink::WebMediaKeySystemMediaCapability& capabilities = 245 // the combinations in accumulated configuration, change accumulated
117 candidate.videoCapabilities[i]; 246 // configuration's distinctiveIdentifier value to "required".
118 if (capabilities.mimeType.isEmpty()) 247 // - Otherwise, change accumulated configuration's distinctiveIdentifier
119 return false; 248 // value to "not-allowed".
120 if (!base::IsStringASCII(capabilities.mimeType) || 249 // (Without robustness support, capabilities do not affect this.)
121 !base::IsStringASCII(capabilities.codecs) || 250 // TODO(sandersd): Implement robustness. http://crbug.com/442586
122 !IsSupportedContentType( 251 if (accumulated_configuration->distinctiveIdentifier ==
123 key_system, base::UTF16ToASCII(capabilities.mimeType), 252 blink::WebMediaKeySystemConfiguration::Requirement::Optional) {
124 base::UTF16ToASCII(capabilities.codecs))) { 253 if (IsDistinctiveIdentifierRequirementSupported(key_system,
125 continue; 254 EME_FEATURE_NOT_ALLOWED,
126 } 255 is_permission_possible)) {
127 // TODO(sandersd): Support robustness. 256 accumulated_configuration->distinctiveIdentifier =
128 if (!capabilities.robustness.isEmpty()) 257 blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed;
129 continue; 258 } else {
130 video_capabilities.push_back(capabilities); 259 accumulated_configuration->distinctiveIdentifier =
260 blink::WebMediaKeySystemConfiguration::Requirement::Required;
131 } 261 }
132
133 if (video_capabilities.empty())
134 return false;
135
136 accumulated_configuration->videoCapabilities = video_capabilities;
137 } 262 }
138 263
139 // TODO(sandersd): Prompt for distinctive identifiers and/or persistent state 264 // 10. If accumulated configuration's persistentState value is "optional",
140 // if required. Make sure that future checks are silent. 265 // follow the steps for the first matching condition from the following
141 // http://crbug.com/446263. 266 // list:
267 // - If the implementation requires persisting state for any of the
268 // combinations in accumulated configuration, change accumulated
269 // configuration's persistentState value to "required".
270 // - Otherwise, change accumulated configuration's persistentState value
271 // to "not-allowed".
272 if (accumulated_configuration->persistentState ==
273 blink::WebMediaKeySystemConfiguration::Requirement::Optional) {
274 if (IsPersistentStateRequirementSupported(key_system,
275 EME_FEATURE_NOT_ALLOWED,
276 is_permission_possible)) {
277 accumulated_configuration->persistentState =
278 blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed;
279 } else {
280 accumulated_configuration->persistentState =
281 blink::WebMediaKeySystemConfiguration::Requirement::Required;
282 }
283 }
142 284
285 // 11. If implementation in the configuration specified by the combination of
286 // the values in accumulated configuration is not supported or not allowed
287 // in the origin, return null.
288 // TODO(sandersd): Implement prompting. http://crbug.com/446263
289 // For now, assume that the permission was not granted.
290 di_requirement =
291 ConvertRequirement(accumulated_configuration->distinctiveIdentifier);
292 if (!IsDistinctiveIdentifierRequirementSupported(key_system, di_requirement,
293 false)) {
294 return false;
295 }
296
297 ps_requirement =
298 ConvertRequirement(accumulated_configuration->persistentState);
299 if (!IsPersistentStateRequirementSupported(key_system, ps_requirement, false))
300 return false;
301
302 // 12. Return accumulated configuration.
143 return true; 303 return true;
144 } 304 }
145 305
146 // Report usage of key system to UMA. There are 2 different counts logged: 306 // Report usage of key system to UMA. There are 2 different counts logged:
147 // 1. The key system is requested. 307 // 1. The key system is requested.
148 // 2. The requested key system and options are supported. 308 // 2. The requested key system and options are supported.
149 // Each stat is only reported once per renderer frame per key system. 309 // Each stat is only reported once per renderer frame per key system.
150 // Note that WebEncryptedMediaClientImpl is only created once by each 310 // Note that WebEncryptedMediaClientImpl is only created once by each
151 // renderer frame. 311 // renderer frame.
152 class WebEncryptedMediaClientImpl::Reporter { 312 class WebEncryptedMediaClientImpl::Reporter {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 WebEncryptedMediaClientImpl::~WebEncryptedMediaClientImpl() { 365 WebEncryptedMediaClientImpl::~WebEncryptedMediaClientImpl() {
206 } 366 }
207 367
208 void WebEncryptedMediaClientImpl::requestMediaKeySystemAccess( 368 void WebEncryptedMediaClientImpl::requestMediaKeySystemAccess(
209 blink::WebEncryptedMediaRequest request) { 369 blink::WebEncryptedMediaRequest request) {
210 // TODO(jrummell): This should be asynchronous. 370 // TODO(jrummell): This should be asynchronous.
211 371
212 // Continued from requestMediaKeySystemAccess(), step 7, from 372 // Continued from requestMediaKeySystemAccess(), step 7, from
213 // https://w3c.github.io/encrypted-media/#requestmediakeysystemaccess 373 // https://w3c.github.io/encrypted-media/#requestmediakeysystemaccess
214 // 374 //
215 // 7.1 If keySystem is not one of the Key Systems supported by the user 375 // 7.1. If keySystem is not one of the Key Systems supported by the user
216 // agent, reject promise with with a new DOMException whose name is 376 // agent, reject promise with with a new DOMException whose name is
217 // NotSupportedError. String comparison is case-sensitive. 377 // NotSupportedError. String comparison is case-sensitive.
218 if (!base::IsStringASCII(request.keySystem())) { 378 if (!base::IsStringASCII(request.keySystem())) {
219 request.requestNotSupported("Only ASCII keySystems are supported"); 379 request.requestNotSupported("Only ASCII keySystems are supported");
220 return; 380 return;
221 } 381 }
222 382
223 std::string key_system = base::UTF16ToASCII(request.keySystem()); 383 std::string key_system = base::UTF16ToASCII(request.keySystem());
224 384
225 // Report this request to the appropriate Reporter. 385 // Report this request to the appropriate Reporter.
226 Reporter* reporter = GetReporter(key_system); 386 Reporter* reporter = GetReporter(key_system);
227 reporter->ReportRequested(); 387 reporter->ReportRequested();
228 388
229 if (!IsSupportedKeySystem(key_system)) { 389 if (!IsSupportedKeySystem(key_system)) {
230 request.requestNotSupported("Unsupported keySystem"); 390 request.requestNotSupported("Unsupported keySystem");
231 return; 391 return;
232 } 392 }
233 393
234 // 7.2 Let implementation be the implementation of keySystem. 394 // 7.2. Let implementation be the implementation of keySystem.
235 // 7.3 For each value in supportedConfigurations, run the GetSupported 395 // 7.3. For each value in supportedConfigurations:
236 // Configuration algorithm and if successful, resolve promise with access
237 // and abort these steps.
238 const blink::WebVector<blink::WebMediaKeySystemConfiguration>& 396 const blink::WebVector<blink::WebMediaKeySystemConfiguration>&
239 configurations = request.supportedConfigurations(); 397 configurations = request.supportedConfigurations();
240
241 // TODO(sandersd): Remove once Blink requires the configurations parameter for
242 // requestMediaKeySystemAccess().
243 if (configurations.isEmpty()) {
244 reporter->ReportSupported();
245 request.requestSucceeded(WebContentDecryptionModuleAccessImpl::Create(
246 request.keySystem(), blink::WebMediaKeySystemConfiguration(),
247 request.securityOrigin(), weak_factory_.GetWeakPtr()));
248 return;
249 }
250
251 for (size_t i = 0; i < configurations.size(); i++) { 398 for (size_t i = 0; i < configurations.size(); i++) {
252 const blink::WebMediaKeySystemConfiguration& candidate = configurations[i]; 399 // 7.3.1. Let candidate configuration be the value.
400 const blink::WebMediaKeySystemConfiguration& candidate_configuration =
401 configurations[i];
402 // 7.3.2. Let supported configuration be the result of executing the Get
403 // Supported Configuration algorithm on implementation, candidate
404 // configuration, and origin.
405 // 7.3.3. If supported configuration is not null, [initialize and return a
406 // new MediaKeySystemAccess object.]
253 blink::WebMediaKeySystemConfiguration accumulated_configuration; 407 blink::WebMediaKeySystemConfiguration accumulated_configuration;
254 if (GetSupportedConfiguration(key_system, candidate, 408 if (GetSupportedConfiguration(key_system, candidate_configuration,
255 request.securityOrigin(), 409 request.securityOrigin(),
256 &accumulated_configuration)) { 410 &accumulated_configuration)) {
257 reporter->ReportSupported(); 411 reporter->ReportSupported();
258 request.requestSucceeded(WebContentDecryptionModuleAccessImpl::Create( 412 request.requestSucceeded(WebContentDecryptionModuleAccessImpl::Create(
259 request.keySystem(), accumulated_configuration, 413 request.keySystem(), accumulated_configuration,
260 request.securityOrigin(), weak_factory_.GetWeakPtr())); 414 request.securityOrigin(), weak_factory_.GetWeakPtr()));
261 return; 415 return;
262 } 416 }
263 } 417 }
264 418
265 // 7.4 Reject promise with a new DOMException whose name is NotSupportedError. 419 // 7.4. Reject promise with a new DOMException whose name is
420 // NotSupportedError.
266 request.requestNotSupported( 421 request.requestNotSupported(
267 "None of the requested configurations were supported."); 422 "None of the requested configurations were supported.");
268 } 423 }
269 424
270 void WebEncryptedMediaClientImpl::CreateCdm( 425 void WebEncryptedMediaClientImpl::CreateCdm(
271 const blink::WebString& key_system, 426 const blink::WebString& key_system,
272 const blink::WebSecurityOrigin& security_origin, 427 const blink::WebSecurityOrigin& security_origin,
273 blink::WebContentDecryptionModuleResult result) { 428 blink::WebContentDecryptionModuleResult result) {
274 WebContentDecryptionModuleImpl::Create(cdm_factory_.get(), security_origin, 429 WebContentDecryptionModuleImpl::Create(cdm_factory_.get(), security_origin,
275 key_system, result); 430 key_system, result);
276 } 431 }
277 432
278 // Lazily create Reporters. 433 // Lazily create Reporters.
279 WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter( 434 WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter(
280 const std::string& key_system) { 435 const std::string& key_system) {
281 std::string uma_name = GetKeySystemNameForUMA(key_system); 436 std::string uma_name = GetKeySystemNameForUMA(key_system);
282 Reporter* reporter = reporters_.get(uma_name); 437 Reporter* reporter = reporters_.get(uma_name);
283 if (reporter != nullptr) 438 if (reporter != nullptr)
284 return reporter; 439 return reporter;
285 440
286 // Reporter not found, so create one. 441 // Reporter not found, so create one.
287 auto result = 442 auto result =
288 reporters_.add(uma_name, make_scoped_ptr(new Reporter(uma_name))); 443 reporters_.add(uma_name, make_scoped_ptr(new Reporter(uma_name)));
289 DCHECK(result.second); 444 DCHECK(result.second);
290 return result.first->second; 445 return result.first->second;
291 } 446 }
292 447
293 } // namespace media 448 } // namespace media
OLDNEW
« no previous file with comments | « media/base/key_systems_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698