Commit d22548a7 authored by Archana Simha's avatar Archana Simha Committed by Commit Bot

[Extensions Metrics] Add user actions for extension uninstall dialog.

Records user actions when a user cancels and accepts the extension uninstall dialog and if the user checks the report abuse box.

Design Doc: http://go/extensionscheckupmetrics

Bug: 1034541
Change-Id: I477a5c03514feb2ea74d92d9c6067b91cc1638b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1972584
Commit-Queue: Archana Simha <archanasimha@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727494}
parent fca2023f
......@@ -7,6 +7,8 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/chrome_app_icon_service.h"
#include "chrome/browser/extensions/extension_service.h"
......@@ -213,6 +215,10 @@ void ExtensionUninstallDialog::OnDialogClosed(CloseAction action) {
switch (action) {
case CLOSE_ACTION_UNINSTALL_AND_CHECKBOX_CHECKED:
success = Uninstall(&error);
base::RecordAction(base::UserMetricsAction(
"Extensions.UninstallDialogReportAbuseChecked"));
base::RecordAction(
base::UserMetricsAction("Extensions.UninstallDialogRemoveClick"));
if (ShouldShowRemoveDataCheckbox()) {
content::ClearSiteData(
base::BindRepeating(
......@@ -233,9 +239,13 @@ void ExtensionUninstallDialog::OnDialogClosed(CloseAction action) {
}
break;
case CLOSE_ACTION_UNINSTALL:
base::RecordAction(
base::UserMetricsAction("Extensions.UninstallDialogRemoveClick"));
success = Uninstall(&error);
break;
case CLOSE_ACTION_CANCELED:
base::RecordAction(
base::UserMetricsAction("Extensions.UninstallDialogCancelClick"));
error = base::ASCIIToUTF16("User canceled uninstall dialog");
break;
case CLOSE_ACTION_LAST:
......@@ -249,6 +259,11 @@ bool ExtensionUninstallDialog::Uninstall(base::string16* error) {
ExtensionRegistry::Get(profile_)->GetExtensionById(
extension_->id(), ExtensionRegistry::EVERYTHING);
if (current_extension) {
if (current_extension->was_installed_by_default()) {
base::RecordAction(base::UserMetricsAction(
"Extensions.RemovedDefaultInstalledExtension"));
}
// Prevent notifications triggered by our request.
observer_.RemoveAll();
return ExtensionSystem::Get(profile_)
......
......@@ -5938,6 +5938,14 @@ 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="Extensions.RemovedDefaultInstalledExtension">
<owner>archanasimha@chromium.org</owner>
<description>
User clicked the &quot;Remove&quot; button in the extension uninstall dialog
which leads to the removal of a default installed extension.
</description>
</action>
<action name="Extensions.RemoveExtensionClick">
<owner>archanasimha@chromium.org</owner>
<description>
......@@ -5947,6 +5955,31 @@ should be able to be added at any place in this file.
</description>
</action>
<action name="Extensions.UninstallDialogCancelClick">
<owner>archanasimha@chromium.org</owner>
<description>
User clicked the &quot;Cancel&quot; button in the extension uninstall
dialog. This cancels the uninstallation of an extension.
</description>
</action>
<action name="Extensions.UninstallDialogRemoveClick">
<owner>archanasimha@chromium.org</owner>
<description>
User clicked the &quot;Remove&quot; button in the chrome://extensions page
uninstall dialog which leads to the removal of an extension.
</description>
</action>
<action name="Extensions.UninstallDialogReportAbuseChecked">
<owner>archanasimha@chromium.org</owner>
<description>
Used checked the &quot;Report Abuse&quot; box and the &quot;Remove&quot;
button in the extension uninstall dialog which leads to the removal of an
extension and reports the extension for abuse.
</description>
</action>
<action name="Extensions.WebStoreLaunch">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<description>Please enter the description of this user action.</description>
......
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