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 "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" |
11 #include "media/base/key_systems.h" | 11 #include "media/base/key_systems.h" |
12 #include "media/base/media_permission.h" | 12 #include "media/base/media_permission.h" |
| 13 #include "media/blink/webcontentdecryptionmodule_impl.h" |
| 14 #include "media/blink/webcontentdecryptionmoduleaccess_impl.h" |
13 #include "net/base/mime_util.h" | 15 #include "net/base/mime_util.h" |
14 #include "third_party/WebKit/public/platform/WebEncryptedMediaRequest.h" | 16 #include "third_party/WebKit/public/platform/WebEncryptedMediaRequest.h" |
15 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h" | 17 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h" |
16 #include "third_party/WebKit/public/platform/WebString.h" | 18 #include "third_party/WebKit/public/platform/WebString.h" |
17 #include "third_party/WebKit/public/platform/WebVector.h" | 19 #include "third_party/WebKit/public/platform/WebVector.h" |
18 #include "webcontentdecryptionmodule_impl.h" | |
19 #include "webcontentdecryptionmoduleaccess_impl.h" | |
20 | 20 |
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, |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 request.requestNotSupported("Only ASCII keySystems are supported"); | 219 request.requestNotSupported("Only ASCII keySystems are supported"); |
220 return; | 220 return; |
221 } | 221 } |
222 | 222 |
223 std::string key_system = base::UTF16ToASCII(request.keySystem()); | 223 std::string key_system = base::UTF16ToASCII(request.keySystem()); |
224 | 224 |
225 // Report this request to the appropriate Reporter. | 225 // Report this request to the appropriate Reporter. |
226 Reporter* reporter = GetReporter(key_system); | 226 Reporter* reporter = GetReporter(key_system); |
227 reporter->ReportRequested(); | 227 reporter->ReportRequested(); |
228 | 228 |
229 if (!IsConcreteSupportedKeySystem(key_system)) { | 229 if (!IsSupportedKeySystem(key_system)) { |
230 request.requestNotSupported("Unsupported keySystem"); | 230 request.requestNotSupported("Unsupported keySystem"); |
231 return; | 231 return; |
232 } | 232 } |
233 | 233 |
234 // 7.2 Let implementation be the implementation of keySystem. | 234 // 7.2 Let implementation be the implementation of keySystem. |
235 // 7.3 For each value in supportedConfigurations, run the GetSupported | 235 // 7.3 For each value in supportedConfigurations, run the GetSupported |
236 // Configuration algorithm and if successful, resolve promise with access | 236 // Configuration algorithm and if successful, resolve promise with access |
237 // and abort these steps. | 237 // and abort these steps. |
238 const blink::WebVector<blink::WebMediaKeySystemConfiguration>& | 238 const blink::WebVector<blink::WebMediaKeySystemConfiguration>& |
239 configurations = request.supportedConfigurations(); | 239 configurations = request.supportedConfigurations(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 return reporter; | 284 return reporter; |
285 | 285 |
286 // Reporter not found, so create one. | 286 // Reporter not found, so create one. |
287 auto result = | 287 auto result = |
288 reporters_.add(uma_name, make_scoped_ptr(new Reporter(uma_name))); | 288 reporters_.add(uma_name, make_scoped_ptr(new Reporter(uma_name))); |
289 DCHECK(result.second); | 289 DCHECK(result.second); |
290 return result.first->second; | 290 return result.first->second; |
291 } | 291 } |
292 | 292 |
293 } // namespace media | 293 } // namespace media |
OLD | NEW |