| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 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. | |
| 48 // This enum should be treated as append-only. | |
| 49 enum PDFLoadStatus { | |
| 50 LOADED_FULL_PAGE_PDF_WITH_PDFIUM = 0, | |
| 51 LOADED_EMBEDDED_PDF_WITH_PDFIUM = 1, | |
| 52 SHOWED_DISABLED_PLUGIN_PLACEHOLDER_FOR_EMBEDDED_PDF = 2, | |
| 53 PDF_LOAD_STATUS_COUNT | |
| 54 }; | |
| 55 | |
| 56 // Sends UMA data, i.e. plugin's type. | 47 // Sends UMA data, i.e. plugin's type. |
| 57 class UMASender { | 48 class UMASender { |
| 58 public: | 49 public: |
| 59 virtual ~UMASender() {} | 50 virtual ~UMASender() {} |
| 60 virtual void SendPluginUMA(ReportType report_type, | 51 virtual void SendPluginUMA(ReportType report_type, |
| 61 PluginType plugin_type) = 0; | 52 PluginType plugin_type) = 0; |
| 62 }; | 53 }; |
| 63 | 54 |
| 64 // Returns singleton instance. | 55 // Returns singleton instance. |
| 65 static PluginUMAReporter* GetInstance(); | 56 static PluginUMAReporter* GetInstance(); |
| 66 | 57 |
| 67 static void ReportPDFLoadStatus(PDFLoadStatus status); | |
| 68 | |
| 69 void ReportPluginMissing(const std::string& plugin_mime_type, | 58 void ReportPluginMissing(const std::string& plugin_mime_type, |
| 70 const GURL& plugin_src); | 59 const GURL& plugin_src); |
| 71 | 60 |
| 72 void ReportPluginDisabled(const std::string& plugin_mime_type, | 61 void ReportPluginDisabled(const std::string& plugin_mime_type, |
| 73 const GURL& plugin_src); | 62 const GURL& plugin_src); |
| 74 | 63 |
| 75 private: | 64 private: |
| 76 friend struct base::DefaultSingletonTraits<PluginUMAReporter>; | 65 friend struct base::DefaultSingletonTraits<PluginUMAReporter>; |
| 77 friend class PluginUMATest; | 66 friend class PluginUMATest; |
| 78 | 67 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 93 PluginType SrcToPluginType(const GURL& src); | 82 PluginType SrcToPluginType(const GURL& src); |
| 94 // Converts plugin's mime type to plugin type. | 83 // Converts plugin's mime type to plugin type. |
| 95 PluginType MimeTypeToPluginType(const std::string& mime_type); | 84 PluginType MimeTypeToPluginType(const std::string& mime_type); |
| 96 | 85 |
| 97 std::unique_ptr<UMASender> report_sender_; | 86 std::unique_ptr<UMASender> report_sender_; |
| 98 | 87 |
| 99 DISALLOW_COPY_AND_ASSIGN(PluginUMAReporter); | 88 DISALLOW_COPY_AND_ASSIGN(PluginUMAReporter); |
| 100 }; | 89 }; |
| 101 | 90 |
| 102 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_UMA_H_ | 91 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_UMA_H_ |
| OLD | NEW |