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

Unified Diff: chrome/renderer/plugins/plugin_uma.h

Issue 13414007: Report disabled plugin in CreatePlugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unittest updated Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/plugins/plugin_uma.h
diff --git a/chrome/renderer/plugins/plugin_uma.h b/chrome/renderer/plugins/plugin_uma.h
index f1eb4cf2d701a2a35cc7f89c81291d43224bd2b5..e32d435ca1ce8554af537f3d1f170030a3893a31 100644
--- a/chrome/renderer/plugins/plugin_uma.h
+++ b/chrome/renderer/plugins/plugin_uma.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
ddorwin 2013/04/04 19:09:50 leave, right?
xhwang 2013/04/04 23:10:33 Done.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,8 +15,13 @@
// ReportPluginMissing should be called whenever plugin that is not available or
// enabled is called. We try to determine plugin's type by requested mime type,
// or, if mime type is unknown, by plugin's src url.
-class MissingPluginReporter {
+class PluginUMAReporter {
public:
+ enum ReportType {
+ MISSING_PLUGIN,
+ DISABLED_PLUGIN
+ };
+
// This must be sync'd with histogram values.
enum PluginType {
WINDOWS_MEDIA_PLAYER = 0,
@@ -31,23 +36,28 @@ class MissingPluginReporter {
class UMASender {
public:
virtual ~UMASender() {}
- virtual void SendPluginUMA(PluginType plugin_type) = 0;
+ virtual void SendPluginUMA(ReportType report_type,
+ PluginType plugin_type) = 0;
};
// Returns singleton instance.
- static MissingPluginReporter* GetInstance();
+ static PluginUMAReporter* GetInstance();
- void ReportPluginMissing(std::string plugin_mime_type,
+ void ReportPluginMissing(const std::string& plugin_mime_type,
const GURL& plugin_src);
- // Used in testing.
- void SetUMASender(UMASender* sender);
+ void ReportPluginDisabled(const std::string& plugin_mime_type,
+ const GURL& plugin_src);
private:
- friend struct DefaultSingletonTraits<MissingPluginReporter>;
+ friend struct DefaultSingletonTraits<PluginUMAReporter>;
+ // For testing.
+ friend void ExpectPluginType(PluginType expected_plugin_type,
+ const std::string& plugin_mime_type,
+ const GURL& plugin_src);
- MissingPluginReporter();
- ~MissingPluginReporter();
+ PluginUMAReporter();
+ ~PluginUMAReporter();
static bool CompareCStrings(const char* first, const char* second);
bool CStringArrayContainsCString(const char** array,
@@ -56,6 +66,9 @@ class MissingPluginReporter {
// Extracts file extension from url.
void ExtractFileExtension(const GURL& src, std::string* extension);
+ PluginType GetPluginType(const std::string& plugin_mime_type,
+ const GURL& plugin_src);
+
// Converts plugin's src to plugin type.
PluginType SrcToPluginType(const GURL& src);
// Converts plugin's mime type to plugin type.
@@ -63,7 +76,7 @@ class MissingPluginReporter {
scoped_ptr<UMASender> report_sender_;
- DISALLOW_COPY_AND_ASSIGN(MissingPluginReporter);
+ DISALLOW_COPY_AND_ASSIGN(PluginUMAReporter);
};
#endif // CHROME_RENDERER_PLUGINS_PLUGIN_UMA_H_

Powered by Google App Engine
This is Rietveld 408576698