| 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" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 blink::WebEncryptedMediaRequest request, | 160 blink::WebEncryptedMediaRequest request, |
| 161 const blink::WebString& error_message) { | 161 const blink::WebString& error_message) { |
| 162 request.requestNotSupported(error_message); | 162 request.requestNotSupported(error_message); |
| 163 } | 163 } |
| 164 | 164 |
| 165 WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter( | 165 WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter( |
| 166 const blink::WebString& key_system) { | 166 const blink::WebString& key_system) { |
| 167 // Assumes that empty will not be found by GetKeySystemNameForUMA(). | 167 // Assumes that empty will not be found by GetKeySystemNameForUMA(). |
| 168 // TODO(sandersd): Avoid doing ASCII conversion more than once. | 168 // TODO(sandersd): Avoid doing ASCII conversion more than once. |
| 169 std::string key_system_ascii; | 169 std::string key_system_ascii; |
| 170 if (base::IsStringASCII(key_system)) | 170 if (key_system.containsOnlyASCII()) |
| 171 key_system_ascii = base::UTF16ToASCII(base::StringPiece16(key_system)); | 171 key_system_ascii = key_system.ascii(); |
| 172 | 172 |
| 173 // Return a per-frame singleton so that UMA reports will be once-per-frame. | 173 // Return a per-frame singleton so that UMA reports will be once-per-frame. |
| 174 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); | 174 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); |
| 175 Reporter* reporter = reporters_.get(uma_name); | 175 Reporter* reporter = reporters_.get(uma_name); |
| 176 if (!reporter) { | 176 if (!reporter) { |
| 177 reporter = new Reporter(uma_name); | 177 reporter = new Reporter(uma_name); |
| 178 reporters_.add(uma_name, base::WrapUnique(reporter)); | 178 reporters_.add(uma_name, base::WrapUnique(reporter)); |
| 179 } | 179 } |
| 180 return reporter; | 180 return reporter; |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace media | 183 } // namespace media |
| OLD | NEW |