Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: chrome/renderer/plugins/plugin_uma.cc

Issue 13601002: Report UMA for Shockwave Flash and Widevine CDM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 12
13 namespace { 13 namespace {
14 14
15 // String we will use to convert mime tyoe to plugin type. 15 // String we will use to convert mime tyoe to plugin type.
16 const char kWindowsMediaPlayerType[] = "application/x-mplayer2"; 16 const char kWindowsMediaPlayerType[] = "application/x-mplayer2";
17 const char kSilverlightTypePrefix[] = "application/x-silverlight"; 17 const char kSilverlightTypePrefix[] = "application/x-silverlight";
18 const char kRealPlayerTypePrefix[] = "audio/x-pn-realaudio"; 18 const char kRealPlayerTypePrefix[] = "audio/x-pn-realaudio";
19 const char kJavaTypeSubstring[] = "application/x-java-applet"; 19 const char kJavaTypeSubstring[] = "application/x-java-applet";
20 const char kQuickTimeType[] = "video/quicktime"; 20 const char kQuickTimeType[] = "video/quicktime";
21 const char kShockwaveFlashType[] = "application/x-shockwave-flash";
22 const char kWidevineCDMType[] = "application/x-ppapi-widevine-cdm";
21 23
22 // Arrays containing file extensions connected with specific plugins. 24 // Arrays containing file extensions connected with specific plugins.
23 // The arrays must be sorted because binary search is used on them. 25 // The arrays must be sorted because binary search is used on them.
24 const char* kWindowsMediaPlayerExtensions[] = { 26 const char* kWindowsMediaPlayerExtensions[] = {
25 ".asx" 27 ".asx"
26 }; 28 };
27 29
28 const char* kRealPlayerExtensions[] = { 30 const char* kRealPlayerExtensions[] = {
29 ".ra", 31 ".ra",
30 ".ram", 32 ".ram",
(...skipping 16 matching lines...) Expand all
47 49
48 class UMASenderImpl : public MissingPluginReporter::UMASender { 50 class UMASenderImpl : public MissingPluginReporter::UMASender {
49 virtual void SendPluginUMA(MissingPluginReporter::PluginType plugin_type) 51 virtual void SendPluginUMA(MissingPluginReporter::PluginType plugin_type)
50 OVERRIDE; 52 OVERRIDE;
51 }; 53 };
52 54
53 void UMASenderImpl::SendPluginUMA( 55 void UMASenderImpl::SendPluginUMA(
54 MissingPluginReporter::PluginType plugin_type) { 56 MissingPluginReporter::PluginType plugin_type) {
55 UMA_HISTOGRAM_ENUMERATION("Plugin.MissingPlugins", 57 UMA_HISTOGRAM_ENUMERATION("Plugin.MissingPlugins",
56 plugin_type, 58 plugin_type,
57 MissingPluginReporter::OTHER); 59 MissingPluginReporter::OTHER);
ddorwin 2013/04/04 20:08:26 You need to use your new PLUGIN_TYPE_MAX here, rig
xhwang 2013/04/05 00:58:18 Done.
58 } 60 }
59 61
60 // static. 62 // static.
61 MissingPluginReporter* MissingPluginReporter::GetInstance() { 63 MissingPluginReporter* MissingPluginReporter::GetInstance() {
62 return Singleton<MissingPluginReporter>::get(); 64 return Singleton<MissingPluginReporter>::get();
63 } 65 }
64 66
65 void MissingPluginReporter::ReportPluginMissing( 67 void MissingPluginReporter::ReportPluginMissing(
66 std::string plugin_mime_type, const GURL& plugin_src) { 68 std::string plugin_mime_type, const GURL& plugin_src) {
67 PluginType plugin_type; 69 PluginType plugin_type;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 size_t last_dot = extension_file_path.find_last_of('.'); 110 size_t last_dot = extension_file_path.find_last_of('.');
109 if (last_dot != std::string::npos) { 111 if (last_dot != std::string::npos) {
110 *extension = extension_file_path.substr(last_dot); 112 *extension = extension_file_path.substr(last_dot);
111 } else { 113 } else {
112 extension->clear(); 114 extension->clear();
113 } 115 }
114 116
115 StringToLowerASCII(extension); 117 StringToLowerASCII(extension);
116 } 118 }
117 119
118 MissingPluginReporter::PluginType MissingPluginReporter::SrcToPluginType( 120 MissingPluginReporter::PluginType MissingPluginReporter::SrcToPluginType(
xhwang 2013/04/03 23:36:55 For flash, do we also want to get plugin type from
xhwang 2013/04/03 23:38:09 +ilja
yzshen1 2013/04/04 17:38:11 I think we could add the extensions for Flash here
ddorwin 2013/04/04 19:52:24 SGTM. Also, should we differentiate "OTHER" mime t
ddorwin 2013/04/04 20:08:26 Even better, (since the meaning of OTHER is/would
xhwang 2013/04/05 00:58:18 Done. Do we want to add more, e.g. fla et al?
xhwang 2013/04/05 00:58:18 Done. Use 240/241 in case we want to add more unsu
ddorwin 2013/04/05 04:21:37 I coud be wrong, but it looks like we only support
xhwang 2013/04/05 05:05:21 Done.
119 const GURL& src) { 121 const GURL& src) {
120 std::string file_extension; 122 std::string file_extension;
121 ExtractFileExtension(src, &file_extension); 123 ExtractFileExtension(src, &file_extension);
122 if (CStringArrayContainsCString(kWindowsMediaPlayerExtensions, 124 if (CStringArrayContainsCString(kWindowsMediaPlayerExtensions,
123 arraysize(kWindowsMediaPlayerExtensions), 125 arraysize(kWindowsMediaPlayerExtensions),
124 file_extension.c_str())) { 126 file_extension.c_str())) {
125 return WINDOWS_MEDIA_PLAYER; 127 return WINDOWS_MEDIA_PLAYER;
126 } 128 }
127 129
128 if (CStringArrayContainsCString(kQuickTimeExtensions, 130 if (CStringArrayContainsCString(kQuickTimeExtensions,
(...skipping 23 matching lines...) Expand all
152 prefix_length = strlen(kRealPlayerTypePrefix); 154 prefix_length = strlen(kRealPlayerTypePrefix);
153 if (strncmp(mime_type.c_str(), kRealPlayerTypePrefix, prefix_length) == 0) 155 if (strncmp(mime_type.c_str(), kRealPlayerTypePrefix, prefix_length) == 0)
154 return REALPLAYER; 156 return REALPLAYER;
155 157
156 if (strstr(mime_type.c_str(), kJavaTypeSubstring)) 158 if (strstr(mime_type.c_str(), kJavaTypeSubstring))
157 return JAVA; 159 return JAVA;
158 160
159 if (strcmp(mime_type.c_str(), kQuickTimeType) == 0) 161 if (strcmp(mime_type.c_str(), kQuickTimeType) == 0)
160 return QUICKTIME; 162 return QUICKTIME;
161 163
164 if (strcmp(mime_type.c_str(), kShockwaveFlashType) == 0)
165 return SHOCKWAVE_FLASH;
166
167 if (strcmp(mime_type.c_str(), kWidevineCDMType) == 0)
168 return WIDEVINE_CDM;
169
162 return OTHER; 170 return OTHER;
163 } 171 }
164
OLDNEW
« chrome/renderer/plugins/plugin_uma.h ('K') | « chrome/renderer/plugins/plugin_uma.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698