Commit ad9bbee1 authored by wfh's avatar wfh Committed by Commit bot

Add UMA actions and histogram for the NPAPI InfoBar.

BUG=380227

Review URL: https://codereview.chromium.org/1130793006

Cr-Commit-Position: refs/heads/master@{#329473}
parent 9a2dbf2b
......@@ -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,35 @@
#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 {
// This enum is recorded in a histogram so entries should not be re-ordered or
// removed.
enum PluginGroup {
GROUP_NAME_UNKNOWN,
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_GOOGLE_TALK,
GROUP_NAME_GOOGLE_EARTH,
GROUP_NAME_COUNT,
};
static const char kLearnMoreUrl[] =
"https://www.google.com/support/chrome/bin/answer.py?answer=6213033";
......@@ -81,6 +102,48 @@ NPAPIRemovalInfoBarDelegate::NPAPIRemovalInfoBarDelegate(
const base::string16& plugin_name,
int message_id)
: plugin_name_(plugin_name), message_id_(message_id) {
content::RecordAction(UserMetricsAction("NPAPIRemovalInfobar.Shown"));
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),
std::make_pair(GROUP_NAME_GOOGLE_TALK,
PluginMetadata::kGoogleTalkGroupName),
std::make_pair(GROUP_NAME_GOOGLE_EARTH,
PluginMetadata::kGoogleEarthGroupName)};
PluginGroup group = GROUP_NAME_UNKNOWN;
std::string name = base::UTF16ToUTF8(plugin_name);
for (const auto& type : types) {
if (name == type.second) {
group = type.first;
break;
}
}
if (message_id == IDS_PLUGINS_NPAPI_REMOVED) {
UMA_HISTOGRAM_ENUMERATION(
"Plugin.NpapiRemovalInfobar.Removed.PluginGroup", group,
GROUP_NAME_COUNT);
} else {
DCHECK_EQ(IDS_PLUGINS_NPAPI_BEING_REMOVED_SOON, message_id);
UMA_HISTOGRAM_ENUMERATION(
"Plugin.NpapiRemovalInfobar.RemovedSoon.PluginGroup", group,
GROUP_NAME_COUNT);
}
}
NPAPIRemovalInfoBarDelegate::~NPAPIRemovalInfoBarDelegate() {
......@@ -109,6 +172,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;
}
......
......@@ -19,6 +19,8 @@ const char PluginMetadata::kRealPlayerGroupName[] = "RealPlayer";
const char PluginMetadata::kSilverlightGroupName[] = "Silverlight";
const char PluginMetadata::kWindowsMediaPlayerGroupName[] =
"Windows Media Player";
const char PluginMetadata::kGoogleTalkGroupName[] = "Google Talk";
const char PluginMetadata::kGoogleEarthGroupName[] = "Google Earth";
PluginMetadata::PluginMetadata(const std::string& identifier,
const base::string16& name,
......
......@@ -34,6 +34,8 @@ class PluginMetadata {
static const char kRealPlayerGroupName[];
static const char kSilverlightGroupName[];
static const char kWindowsMediaPlayerGroupName[];
static const char kGoogleTalkGroupName[];
static const char kGoogleEarthGroupName[];
PluginMetadata(const std::string& identifier,
const base::string16& name,
......
......@@ -8210,6 +8210,18 @@ should be able to be added at any place in this file.
<description>Please enter the description of this user action.</description>
</action>
<action name="NPAPIRemovalInfobar.LearnMore">
<owner>wfh@chromium.org</owner>
<description>
Recorded when the NPAPI removal infobar link is clicked.
</description>
</action>
<action name="NPAPIRemovalInfobar.Shown">
<owner>wfh@chromium.org</owner>
<description>Recorded when the NPAPI removal infobar is shown.</description>
</action>
<action name="NTPPromoClosed">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<description>Please enter the description of this user action.</description>
......
......@@ -29109,6 +29109,26 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<summary>Collects Flash usage data.</summary>
</histogram>
<histogram name="Plugin.NPAPIRemovalInfobar.Removed.PluginGroup"
enum="PluginGroup">
<owner>wfh@chromium.org</owner>
<summary>
The plugin group of an NPAPI plugin that is no longer supported. Recorded
when the NPAPI removal infobar is shown for a plugin which is no longer
supported.
</summary>
</histogram>
<histogram name="Plugin.NPAPIRemovalInfobar.RemovedSoon.PluginGroup"
enum="PluginGroup">
<owner>wfh@chromium.org</owner>
<summary>
The plugin group of an NPAPI plugin that will be unsupported soon. Recorded
when the NPAPI removal infobar is shown after an NPAPI plugin first loads to
warn the user that NPAPI support for this plugin will be removed soon.
</summary>
</histogram>
<histogram name="Plugin.NPAPIStatus" enum="NPAPIPluginStatus">
<owner>wfh@chromium.org</owner>
<summary>
......@@ -60000,6 +60020,19 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="2" label="PLUGIN_DISABLED"/>
</enum>
<enum name="PluginGroup" type="int">
<int value="0" label="Adobe Reader"/>
<int value="1" label="Other Plugin"/>
<int value="2" label="Java"/>
<int value="3" label="Quicktime"/>
<int value="4" label="Shockwave"/>
<int value="5" label="Real Player"/>
<int value="6" label="Silverlight"/>
<int value="7" label="Windows Media Player"/>
<int value="8" label="Google Talk"/>
<int value="9" label="Google Earth"/>
</enum>
<enum name="PluginListError" type="int">
<int value="0" label="NoError"/>
<int value="1" label="JsonInvalidEscape"/>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment