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

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

Issue 2852193002: PDF: Add UMA to track successful / failed PDF loads (Closed)
Patch Set: fix histograms Created 3 years, 7 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
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 #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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 // Used to send UMA data about missing plugins to UMA histogram server. Method 17 // Used to send UMA data about missing plugins to UMA histogram server. Method
18 // ReportPluginMissing should be called whenever plugin that is not available or 18 // ReportPluginMissing should be called whenever plugin that is not available or
19 // enabled is called. We try to determine plugin's type by requested mime type, 19 // enabled is called. We try to determine plugin's type by requested mime type,
20 // or, if mime type is unknown, by plugin's src url. 20 // or, if mime type is unknown, by plugin's src url.
21 class PluginUMAReporter { 21 class PluginUMAReporter {
22 public: 22 public:
23 enum ReportType { 23 enum ReportType {
24 MISSING_PLUGIN, 24 MISSING_PLUGIN,
25 DISABLED_PLUGIN 25 DISABLED_PLUGIN,
26 }; 26 };
27 27
28 // Make sure the enum list in tools/histogram/histograms.xml is updated with 28 // Make sure the enum list in tools/histogram/histograms.xml is updated with
29 // any change in this list. 29 // any change in this list.
30 enum PluginType { 30 enum PluginType {
31 WINDOWS_MEDIA_PLAYER = 0, 31 WINDOWS_MEDIA_PLAYER = 0,
32 SILVERLIGHT = 1, 32 SILVERLIGHT = 1,
33 REALPLAYER = 2, 33 REALPLAYER = 2,
34 JAVA = 3, 34 JAVA = 3,
35 QUICKTIME = 4, 35 QUICKTIME = 4,
36 OTHER = 5, // This is obsolete and replaced by UNSUPPORTED_* types. 36 OTHER = 5, // This is obsolete and replaced by UNSUPPORTED_* types.
37 UNSUPPORTED_MIMETYPE, 37 UNSUPPORTED_MIMETYPE,
38 UNSUPPORTED_EXTENSION, 38 UNSUPPORTED_EXTENSION,
39 // NOTE: Add new unsupported types only immediately above this line. 39 // NOTE: Add new unsupported types only immediately above this line.
40 BROWSER_PLUGIN = 10, 40 BROWSER_PLUGIN = 10,
41 SHOCKWAVE_FLASH, 41 SHOCKWAVE_FLASH,
42 WIDEVINE_CDM, 42 WIDEVINE_CDM,
43 // NOTE: Add new plugin types only immediately above this line. 43 // NOTE: Add new plugin types only immediately above this line.
44 PLUGIN_TYPE_MAX 44 PLUGIN_TYPE_MAX
45 }; 45 };
46 46
47 // Must be kept in sync with PDFLoadStatus enum in histograms.xml.
Ilya Sherman 2017/05/08 17:59:57 Please also document that this enum should be trea
tommycli 2017/05/08 18:16:17 Done.
48 enum PDFLoadStatus {
49 LOADED_FULL_PAGE_PDF_WITH_PDFIUM = 0,
50 LOADED_EMBEDDED_PDF_WITH_PDFIUM = 1,
51 SHOWED_DISABLED_PLUGIN_PLACEHOLDER_FOR_EMBEDDED_PDF = 2,
52 PDF_LOAD_STATUS_MAX
Ilya Sherman 2017/05/08 17:59:57 Optional nit: Typically, "max" is used as an alias
tommycli 2017/05/08 18:16:17 Done.
53 };
54
47 // Sends UMA data, i.e. plugin's type. 55 // Sends UMA data, i.e. plugin's type.
48 class UMASender { 56 class UMASender {
49 public: 57 public:
50 virtual ~UMASender() {} 58 virtual ~UMASender() {}
51 virtual void SendPluginUMA(ReportType report_type, 59 virtual void SendPluginUMA(ReportType report_type,
52 PluginType plugin_type) = 0; 60 PluginType plugin_type) = 0;
53 }; 61 };
54 62
55 // Returns singleton instance. 63 // Returns singleton instance.
56 static PluginUMAReporter* GetInstance(); 64 static PluginUMAReporter* GetInstance();
57 65
66 static void ReportPDFLoadStatus(PDFLoadStatus status);
67
58 void ReportPluginMissing(const std::string& plugin_mime_type, 68 void ReportPluginMissing(const std::string& plugin_mime_type,
59 const GURL& plugin_src); 69 const GURL& plugin_src);
60 70
61 void ReportPluginDisabled(const std::string& plugin_mime_type, 71 void ReportPluginDisabled(const std::string& plugin_mime_type,
62 const GURL& plugin_src); 72 const GURL& plugin_src);
63 73
64 private: 74 private:
65 friend struct base::DefaultSingletonTraits<PluginUMAReporter>; 75 friend struct base::DefaultSingletonTraits<PluginUMAReporter>;
66 friend class PluginUMATest; 76 friend class PluginUMATest;
67 77
(...skipping 14 matching lines...) Expand all
82 PluginType SrcToPluginType(const GURL& src); 92 PluginType SrcToPluginType(const GURL& src);
83 // Converts plugin's mime type to plugin type. 93 // Converts plugin's mime type to plugin type.
84 PluginType MimeTypeToPluginType(const std::string& mime_type); 94 PluginType MimeTypeToPluginType(const std::string& mime_type);
85 95
86 std::unique_ptr<UMASender> report_sender_; 96 std::unique_ptr<UMASender> report_sender_;
87 97
88 DISALLOW_COPY_AND_ASSIGN(PluginUMAReporter); 98 DISALLOW_COPY_AND_ASSIGN(PluginUMAReporter);
89 }; 99 };
90 100
91 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_UMA_H_ 101 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_UMA_H_
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | chrome/renderer/plugins/plugin_uma.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698