| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/renderer/plugins/plugin_uma.h" | 5 #include "chrome/renderer/plugins/plugin_uma.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 | 9 |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 if (extension_file_path.empty()) | 99 if (extension_file_path.empty()) |
| 100 extension_file_path = src.host(); | 100 extension_file_path = src.host(); |
| 101 | 101 |
| 102 size_t last_dot = extension_file_path.find_last_of('.'); | 102 size_t last_dot = extension_file_path.find_last_of('.'); |
| 103 if (last_dot != std::string::npos) { | 103 if (last_dot != std::string::npos) { |
| 104 *extension = extension_file_path.substr(last_dot); | 104 *extension = extension_file_path.substr(last_dot); |
| 105 } else { | 105 } else { |
| 106 extension->clear(); | 106 extension->clear(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 base::StringToLowerASCII(extension); | 109 *extension = base::ToLowerASCII(*extension); |
| 110 } | 110 } |
| 111 | 111 |
| 112 PluginUMAReporter::PluginType PluginUMAReporter::GetPluginType( | 112 PluginUMAReporter::PluginType PluginUMAReporter::GetPluginType( |
| 113 const std::string& plugin_mime_type, | 113 const std::string& plugin_mime_type, |
| 114 const GURL& plugin_src) { | 114 const GURL& plugin_src) { |
| 115 // If we know plugin's mime type, we use it to determine plugin's type. Else, | 115 // If we know plugin's mime type, we use it to determine plugin's type. Else, |
| 116 // we try to determine plugin type using plugin source's extension. | 116 // we try to determine plugin type using plugin source's extension. |
| 117 if (!plugin_mime_type.empty()) | 117 if (!plugin_mime_type.empty()) |
| 118 return MimeTypeToPluginType(base::StringToLowerASCII(plugin_mime_type)); | 118 return MimeTypeToPluginType(base::ToLowerASCII(plugin_mime_type)); |
| 119 | 119 |
| 120 return SrcToPluginType(plugin_src); | 120 return SrcToPluginType(plugin_src); |
| 121 } | 121 } |
| 122 | 122 |
| 123 PluginUMAReporter::PluginType PluginUMAReporter::SrcToPluginType( | 123 PluginUMAReporter::PluginType PluginUMAReporter::SrcToPluginType( |
| 124 const GURL& src) { | 124 const GURL& src) { |
| 125 std::string file_extension; | 125 std::string file_extension; |
| 126 ExtractFileExtension(src, &file_extension); | 126 ExtractFileExtension(src, &file_extension); |
| 127 if (CStringArrayContainsCString(kWindowsMediaPlayerExtensions, | 127 if (CStringArrayContainsCString(kWindowsMediaPlayerExtensions, |
| 128 arraysize(kWindowsMediaPlayerExtensions), | 128 arraysize(kWindowsMediaPlayerExtensions), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 return SHOCKWAVE_FLASH; | 178 return SHOCKWAVE_FLASH; |
| 179 } | 179 } |
| 180 | 180 |
| 181 #if defined(ENABLE_PEPPER_CDMS) | 181 #if defined(ENABLE_PEPPER_CDMS) |
| 182 if (mime_type == kWidevineCdmPluginMimeType) | 182 if (mime_type == kWidevineCdmPluginMimeType) |
| 183 return WIDEVINE_CDM; | 183 return WIDEVINE_CDM; |
| 184 #endif | 184 #endif |
| 185 | 185 |
| 186 return UNSUPPORTED_MIMETYPE; | 186 return UNSUPPORTED_MIMETYPE; |
| 187 } | 187 } |
| OLD | NEW |