| 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/memory/ptr_util.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "media/base/key_systems.h" | 14 #include "media/base/key_systems.h" |
| 15 #include "media/base/media_client.h" | 15 #include "media/base/media_client.h" |
| 16 #include "media/base/media_permission.h" | 16 #include "media/base/media_permission.h" |
| 17 #include "media/blink/webcontentdecryptionmodule_impl.h" | 17 #include "media/blink/webcontentdecryptionmodule_impl.h" |
| 18 #include "media/blink/webcontentdecryptionmoduleaccess_impl.h" | 18 #include "media/blink/webcontentdecryptionmoduleaccess_impl.h" |
| 19 #include "third_party/WebKit/public/platform/URLConversion.h" | 19 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 20 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 20 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
| 21 #include "third_party/WebKit/public/platform/WebEncryptedMediaRequest.h" | 21 #include "third_party/WebKit/public/platform/WebEncryptedMediaRequest.h" |
| 22 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h" | 22 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h" |
| 23 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 23 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 24 #include "third_party/WebKit/public/platform/WebString.h" | 24 #include "third_party/WebKit/public/platform/WebString.h" |
| 25 #include "url/gurl.h" |
| 26 #include "url/origin.h" |
| 25 | 27 |
| 26 namespace media { | 28 namespace media { |
| 27 | 29 |
| 28 namespace { | 30 namespace { |
| 29 | 31 |
| 30 // Used to name UMAs in Reporter. | 32 // Used to name UMAs in Reporter. |
| 31 const char kKeySystemSupportUMAPrefix[] = | 33 const char kKeySystemSupportUMAPrefix[] = |
| 32 "Media.EME.RequestMediaKeySystemAccess."; | 34 "Media.EME.RequestMediaKeySystemAccess."; |
| 33 | 35 |
| 34 } // namespace | 36 } // namespace |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 97 } |
| 96 | 98 |
| 97 WebEncryptedMediaClientImpl::~WebEncryptedMediaClientImpl() { | 99 WebEncryptedMediaClientImpl::~WebEncryptedMediaClientImpl() { |
| 98 } | 100 } |
| 99 | 101 |
| 100 void WebEncryptedMediaClientImpl::requestMediaKeySystemAccess( | 102 void WebEncryptedMediaClientImpl::requestMediaKeySystemAccess( |
| 101 blink::WebEncryptedMediaRequest request) { | 103 blink::WebEncryptedMediaRequest request) { |
| 102 GetReporter(request.keySystem())->ReportRequested(); | 104 GetReporter(request.keySystem())->ReportRequested(); |
| 103 | 105 |
| 104 if (GetMediaClient()) { | 106 if (GetMediaClient()) { |
| 105 GURL security_origin( | 107 GURL security_origin(url::Origin(request.getSecurityOrigin()).GetURL()); |
| 106 blink::WebStringToGURL(request.getSecurityOrigin().toString())); | |
| 107 | 108 |
| 108 GetMediaClient()->RecordRapporURL("Media.OriginUrl.EME", security_origin); | 109 GetMediaClient()->RecordRapporURL("Media.OriginUrl.EME", security_origin); |
| 109 | 110 |
| 110 if (!request.getSecurityOrigin().isPotentiallyTrustworthy()) { | 111 if (!request.getSecurityOrigin().isPotentiallyTrustworthy()) { |
| 111 GetMediaClient()->RecordRapporURL("Media.OriginUrl.EME.Insecure", | 112 GetMediaClient()->RecordRapporURL("Media.OriginUrl.EME.Insecure", |
| 112 security_origin); | 113 security_origin); |
| 113 } | 114 } |
| 114 } | 115 } |
| 115 | 116 |
| 116 key_system_config_selector_.SelectConfig( | 117 key_system_config_selector_.SelectConfig( |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); | 174 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); |
| 174 Reporter* reporter = reporters_.get(uma_name); | 175 Reporter* reporter = reporters_.get(uma_name); |
| 175 if (!reporter) { | 176 if (!reporter) { |
| 176 reporter = new Reporter(uma_name); | 177 reporter = new Reporter(uma_name); |
| 177 reporters_.add(uma_name, base::WrapUnique(reporter)); | 178 reporters_.add(uma_name, base::WrapUnique(reporter)); |
| 178 } | 179 } |
| 179 return reporter; | 180 return reporter; |
| 180 } | 181 } |
| 181 | 182 |
| 182 } // namespace media | 183 } // namespace media |
| OLD | NEW |