| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 const blink::WebString& error_message) { | 144 const blink::WebString& error_message) { |
| 145 request.requestNotSupported(error_message); | 145 request.requestNotSupported(error_message); |
| 146 } | 146 } |
| 147 | 147 |
| 148 WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter( | 148 WebEncryptedMediaClientImpl::Reporter* WebEncryptedMediaClientImpl::GetReporter( |
| 149 const blink::WebString& key_system) { | 149 const blink::WebString& key_system) { |
| 150 // Assumes that empty will not be found by GetKeySystemNameForUMA(). | 150 // Assumes that empty will not be found by GetKeySystemNameForUMA(). |
| 151 // TODO(sandersd): Avoid doing ASCII conversion more than once. | 151 // TODO(sandersd): Avoid doing ASCII conversion more than once. |
| 152 std::string key_system_ascii; | 152 std::string key_system_ascii; |
| 153 if (base::IsStringASCII(key_system)) | 153 if (base::IsStringASCII(key_system)) |
| 154 key_system_ascii = base::UTF16ToASCII(key_system); | 154 key_system_ascii = base::UTF16ToASCII(base::StringPiece16(key_system)); |
| 155 | 155 |
| 156 // Return a per-frame singleton so that UMA reports will be once-per-frame. | 156 // Return a per-frame singleton so that UMA reports will be once-per-frame. |
| 157 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); | 157 std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); |
| 158 Reporter* reporter = reporters_.get(uma_name); | 158 Reporter* reporter = reporters_.get(uma_name); |
| 159 if (!reporter) { | 159 if (!reporter) { |
| 160 reporter = new Reporter(uma_name); | 160 reporter = new Reporter(uma_name); |
| 161 reporters_.add(uma_name, make_scoped_ptr(reporter)); | 161 reporters_.add(uma_name, make_scoped_ptr(reporter)); |
| 162 } | 162 } |
| 163 return reporter; | 163 return reporter; |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace media | 166 } // namespace media |
| OLD | NEW |