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

Unified Diff: chrome/browser/plugins/chrome_plugin_service_filter.cc

Issue 1130793006: Add UMA actions and histogram for the NPAPI InfoBar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change to histogram Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/actions/actions.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/chrome_plugin_service_filter.cc
diff --git a/chrome/browser/plugins/chrome_plugin_service_filter.cc b/chrome/browser/plugins/chrome_plugin_service_filter.cc
index 35962492ac85ad93c3ef94d9cccc1f01b4913684..4bc03e453120a99ddab85e66c3533cc94c901834 100644
--- a/chrome/browser/plugins/chrome_plugin_service_filter.cc
+++ b/chrome/browser/plugins/chrome_plugin_service_filter.cc
@@ -4,8 +4,11 @@
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/logging.h"
+#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/infobars/infobar_service.h"
@@ -24,17 +27,31 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/resource_context.h"
+#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "grit/components_strings.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/window_open_disposition.h"
+using base::UserMetricsAction;
using content::BrowserThread;
using content::PluginService;
namespace {
+enum PluginGroup {
Alexei Svitkine (slow) 2015/05/12 17:38:15 Nit: Add a comment that this is used in UMA and en
Will Harris 2015/05/12 18:25:48 Done.
+ GROUP_NAME_ADOBE_READER,
+ GROUP_NAME_JAVA,
+ GROUP_NAME_QUICKTIME,
+ GROUP_NAME_SHOCKWAVE,
+ GROUP_NAME_REALPLAYER,
+ GROUP_NAME_SILVERLIGHT,
+ GROUP_NAME_WINDOWS_MEDIA_PLAYER,
+ GROUP_NAME_UNKNOWN,
+ GROUP_NAME_COUNT,
+};
+
static const char kLearnMoreUrl[] =
"https://www.google.com/support/chrome/bin/answer.py?answer=6213033";
@@ -81,6 +98,46 @@ NPAPIRemovalInfoBarDelegate::NPAPIRemovalInfoBarDelegate(
const base::string16& plugin_name,
int message_id)
: plugin_name_(plugin_name), message_id_(message_id) {
+ content::RecordAction(UserMetricsAction("NPAPIRemovalInfobar.Shown"));
+
+ std::string name = base::UTF16ToUTF8(plugin_name);
Alexei Svitkine (slow) 2015/05/12 17:38:15 Nit: Move this closer to where it's used - i.e. ab
Will Harris 2015/05/12 18:25:48 Done.
+
+ std::pair<PluginGroup, const char*> types[] = {
+ std::make_pair(GROUP_NAME_ADOBE_READER,
+ PluginMetadata::kAdobeReaderGroupName),
+ std::make_pair(GROUP_NAME_JAVA,
+ PluginMetadata::kJavaGroupName),
+ std::make_pair(GROUP_NAME_QUICKTIME,
+ PluginMetadata::kQuickTimeGroupName),
+ std::make_pair(GROUP_NAME_SHOCKWAVE,
+ PluginMetadata::kShockwaveGroupName),
+ std::make_pair(GROUP_NAME_REALPLAYER,
+ PluginMetadata::kRealPlayerGroupName),
+ std::make_pair(GROUP_NAME_SILVERLIGHT,
+ PluginMetadata::kSilverlightGroupName),
+ std::make_pair(GROUP_NAME_WINDOWS_MEDIA_PLAYER,
+ PluginMetadata::kWindowsMediaPlayerGroupName)};
+
+ PluginGroup group = GROUP_NAME_UNKNOWN;
+
+ for (auto type : types) {
Alexei Svitkine (slow) 2015/05/12 17:38:15 Nit: const auto&
Will Harris 2015/05/12 18:25:48 Done.
+ if (name == type.second) {
+ group = type.first;
+ break;
+ }
+ }
+
+ if (message_id == IDS_PLUGINS_NPAPI_REMOVED) {
+ UMA_HISTOGRAM_ENUMERATION("NPAPIRemovalInfobar.Removed.PluginGroup",
+ group, GROUP_NAME_COUNT);
+ content::RecordAction(
+ UserMetricsAction("NPAPIRemovalInfobar.Shown.Removed"));
+ } else {
Alexei Svitkine (slow) 2015/05/12 17:38:15 Does it make sense to add a DCHECK on the message_
Will Harris 2015/05/12 18:25:48 Done.
+ UMA_HISTOGRAM_ENUMERATION("NPAPIRemovalInfobar.RemovedSoon.PluginGroup",
+ group, GROUP_NAME_COUNT);
+ content::RecordAction(
+ UserMetricsAction("NPAPIRemovalInfobar.Shown.RemovedSoon"));
Alexei Svitkine (slow) 2015/05/12 17:38:15 Are the Removed and RemovedSoon actions necessary?
Will Harris 2015/05/12 18:25:48 Done.
+ }
}
NPAPIRemovalInfoBarDelegate::~NPAPIRemovalInfoBarDelegate() {
@@ -109,6 +166,7 @@ bool NPAPIRemovalInfoBarDelegate::LinkClicked(
GURL(kLearnMoreUrl), content::Referrer(),
(disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
ui::PAGE_TRANSITION_LINK, false));
+ content::RecordAction(UserMetricsAction("NPAPIRemovalInfobar.LearnMore"));
return true;
}
« no previous file with comments | « no previous file | tools/metrics/actions/actions.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698