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 #ifndef CHROME_RENDERER_PLUGINS_PLUGIN_UMA_H_ | 5 #ifndef CHROME_RENDERER_PLUGINS_PLUGIN_UMA_H_ |
6 #define CHROME_RENDERER_PLUGINS_PLUGIN_UMA_H_ | 6 #define CHROME_RENDERER_PLUGINS_PLUGIN_UMA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 | 13 |
14 // Used to send UMA data about missing plugins to UMA histogram server. Method | 14 // Used to send UMA data about missing plugins to UMA histogram server. Method |
15 // ReportPluginMissing should be called whenever plugin that is not available or | 15 // ReportPluginMissing should be called whenever plugin that is not available or |
16 // enabled is called. We try to determine plugin's type by requested mime type, | 16 // enabled is called. We try to determine plugin's type by requested mime type, |
17 // or, if mime type is unknown, by plugin's src url. | 17 // or, if mime type is unknown, by plugin's src url. |
18 class PluginUMAReporter { | 18 class PluginUMAReporter { |
19 public: | 19 public: |
20 enum ReportType { | 20 enum ReportType { |
21 MISSING_PLUGIN, | 21 MISSING_PLUGIN, |
22 DISABLED_PLUGIN | 22 DISABLED_PLUGIN |
23 }; | 23 }; |
24 | 24 |
25 // This must be sync'd with histogram values. | 25 // Make sure the enum list in tools/histogram/histograms.xml is updated with |
| 26 // any change in this list. |
26 enum PluginType { | 27 enum PluginType { |
27 WINDOWS_MEDIA_PLAYER = 0, | 28 WINDOWS_MEDIA_PLAYER = 0, |
28 SILVERLIGHT = 1, | 29 SILVERLIGHT = 1, |
29 REALPLAYER = 2, | 30 REALPLAYER = 2, |
30 JAVA = 3, | 31 JAVA = 3, |
31 QUICKTIME = 4, | 32 QUICKTIME = 4, |
32 OTHER = 5 | 33 OTHER = 5, // This is obsolete and replaced by UNSUPPORTED_* types. |
| 34 UNSUPPORTED_MIMETYPE, |
| 35 UNSUPPORTED_EXTENSION, |
| 36 // NOTE: Add new unsupported types only immediately above this line. |
| 37 BROWSER_PLUGIN = 10, |
| 38 SHOCKWAVE_FLASH, |
| 39 WIDEVINE_CDM, |
| 40 // NOTE: Add new plugin types only immediately above this line. |
| 41 PLUGIN_TYPE_MAX |
33 }; | 42 }; |
34 | 43 |
35 // Sends UMA data, i.e. plugin's type. | 44 // Sends UMA data, i.e. plugin's type. |
36 class UMASender { | 45 class UMASender { |
37 public: | 46 public: |
38 virtual ~UMASender() {} | 47 virtual ~UMASender() {} |
39 virtual void SendPluginUMA(ReportType report_type, | 48 virtual void SendPluginUMA(ReportType report_type, |
40 PluginType plugin_type) = 0; | 49 PluginType plugin_type) = 0; |
41 }; | 50 }; |
42 | 51 |
(...skipping 28 matching lines...) Expand all Loading... |
71 // Converts plugin's mime type to plugin type. | 80 // Converts plugin's mime type to plugin type. |
72 PluginType MimeTypeToPluginType(const std::string& mime_type); | 81 PluginType MimeTypeToPluginType(const std::string& mime_type); |
73 | 82 |
74 scoped_ptr<UMASender> report_sender_; | 83 scoped_ptr<UMASender> report_sender_; |
75 | 84 |
76 DISALLOW_COPY_AND_ASSIGN(PluginUMAReporter); | 85 DISALLOW_COPY_AND_ASSIGN(PluginUMAReporter); |
77 }; | 86 }; |
78 | 87 |
79 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_UMA_H_ | 88 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_UMA_H_ |
80 | 89 |
OLD | NEW |