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/bind.h" | 7 #include "base/bind.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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 request.keySystem(), request.supportedConfigurations(), | 98 request.keySystem(), request.supportedConfigurations(), |
99 request.securityOrigin(), are_secure_codecs_supported_cb_.Run(), | 99 request.securityOrigin(), are_secure_codecs_supported_cb_.Run(), |
100 base::Bind(&WebEncryptedMediaClientImpl::OnRequestSucceeded, | 100 base::Bind(&WebEncryptedMediaClientImpl::OnRequestSucceeded, |
101 weak_factory_.GetWeakPtr(), request), | 101 weak_factory_.GetWeakPtr(), request), |
102 base::Bind(&WebEncryptedMediaClientImpl::OnRequestNotSupported, | 102 base::Bind(&WebEncryptedMediaClientImpl::OnRequestNotSupported, |
103 weak_factory_.GetWeakPtr(), request)); | 103 weak_factory_.GetWeakPtr(), request)); |
104 } | 104 } |
105 | 105 |
106 void WebEncryptedMediaClientImpl::CreateCdm( | 106 void WebEncryptedMediaClientImpl::CreateCdm( |
107 const blink::WebString& key_system, | 107 const blink::WebString& key_system, |
| 108 bool allow_distinctive_identifier, |
| 109 bool allow_persistent_state, |
108 const blink::WebSecurityOrigin& security_origin, | 110 const blink::WebSecurityOrigin& security_origin, |
109 const CdmConfig& cdm_config, | |
110 blink::WebContentDecryptionModuleResult result) { | 111 blink::WebContentDecryptionModuleResult result) { |
111 WebContentDecryptionModuleImpl::Create( | 112 WebContentDecryptionModuleImpl::Create( |
112 cdm_factory_, key_system, security_origin, cdm_config, result); | 113 cdm_factory_, key_system, allow_distinctive_identifier, |
| 114 allow_persistent_state, security_origin, result); |
113 } | 115 } |
114 | 116 |
115 void WebEncryptedMediaClientImpl::OnRequestSucceeded( | 117 void WebEncryptedMediaClientImpl::OnRequestSucceeded( |
116 blink::WebEncryptedMediaRequest request, | 118 blink::WebEncryptedMediaRequest request, |
117 const blink::WebMediaKeySystemConfiguration& accumulated_configuration, | 119 const blink::WebMediaKeySystemConfiguration& accumulated_configuration, |
118 const CdmConfig& cdm_config) { | 120 bool are_secure_codecs_required) { |
119 GetReporter(request.keySystem())->ReportSupported(); | 121 GetReporter(request.keySystem())->ReportSupported(); |
120 // TODO(sandersd): Pass |are_secure_codecs_required| along and use it to | 122 // TODO(sandersd): Pass |are_secure_codecs_required| along and use it to |
121 // configure the CDM security level and use of secure surfaces on Android. | 123 // configure the CDM security level and use of secure surfaces on Android. |
122 request.requestSucceeded(WebContentDecryptionModuleAccessImpl::Create( | 124 request.requestSucceeded(WebContentDecryptionModuleAccessImpl::Create( |
123 request.keySystem(), request.securityOrigin(), accumulated_configuration, | 125 request.keySystem(), accumulated_configuration, request.securityOrigin(), |
124 cdm_config, weak_factory_.GetWeakPtr())); | 126 weak_factory_.GetWeakPtr())); |
125 } | 127 } |
126 | 128 |
127 void WebEncryptedMediaClientImpl::OnRequestNotSupported( | 129 void WebEncryptedMediaClientImpl::OnRequestNotSupported( |
128 blink::WebEncryptedMediaRequest request, | 130 blink::WebEncryptedMediaRequest request, |
129 const blink::WebString& error_message) { | 131 const blink::WebString& error_message) { |
130 request.requestNotSupported(error_message); | 132 request.requestNotSupported(error_message); |
131 } | 133 } |
132 | 134 |
133 WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter( | 135 WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter( |
134 const blink::WebString& key_system) { | 136 const blink::WebString& key_system) { |
135 // Assumes that empty will not be found by GetKeySystemNameForUMA(). | 137 // Assumes that empty will not be found by GetKeySystemNameForUMA(). |
136 // TODO(sandersd): Avoid doing ASCII conversion more than once. | 138 // TODO(sandersd): Avoid doing ASCII conversion more than once. |
137 std::string key_system_ascii; | 139 std::string key_system_ascii; |
138 if (base::IsStringASCII(key_system)) | 140 if (base::IsStringASCII(key_system)) |
139 key_system_ascii = base::UTF16ToASCII(key_system); | 141 key_system_ascii = base::UTF16ToASCII(key_system); |
140 | 142 |
141 // Return a per-frame singleton so that UMA reports will be once-per-frame. | 143 // Return a per-frame singleton so that UMA reports will be once-per-frame. |
142 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); | 144 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); |
143 Reporter* reporter = reporters_.get(uma_name); | 145 Reporter* reporter = reporters_.get(uma_name); |
144 if (!reporter) { | 146 if (!reporter) { |
145 reporter = new Reporter(uma_name); | 147 reporter = new Reporter(uma_name); |
146 reporters_.add(uma_name, make_scoped_ptr(reporter)); | 148 reporters_.add(uma_name, make_scoped_ptr(reporter)); |
147 } | 149 } |
148 return reporter; | 150 return reporter; |
149 } | 151 } |
150 | 152 |
151 } // namespace media | 153 } // namespace media |
OLD | NEW |