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