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

Unified Diff: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc

Issue 2739513002: Settings reset prompt: add UMA metrics reporting. (Closed)
Patch Set: Adds histograms to log what is reset when prompt is accepted Created 3 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/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc
diff --git a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc
index 1689fd8bb00307a6f0322b98589e348e8565bc9b..1cce55ebc0959f5c33286b67a3272bd9f443f175 100644
--- a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc
+++ b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc
@@ -10,6 +10,9 @@
#include "base/bind_helpers.h"
#include "base/location.h"
#include "base/logging.h"
+#include "base/metrics/histogram_macros.h"
+#include "base/metrics/user_metrics.h"
+#include "base/metrics/user_metrics_action.h"
#include "base/time/time.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_config.h"
@@ -53,7 +56,12 @@ bool ResetHomepageEnabled(const SettingsResetPromptModel& model) {
// the settings reset prompt if required by the model and there is at least one
// non-incognito browser available for the corresponding profile.
void OnModelCreated(std::unique_ptr<SettingsResetPromptModel> model) {
- if (!model || !model->ShouldPromptForReset())
+ if (!model)
+ return;
+
+ model->ReportUmaMetrics();
+
+ if (!model->ShouldPromptForReset())
return;
Profile* profile = model->profile();
@@ -137,15 +145,28 @@ gfx::Range SettingsResetPromptController::GetMainTextUrlRange() const {
void SettingsResetPromptController::DialogShown() {
model_->DialogShown();
+ time_dialog_shown_ = base::Time::Now();
+ base::RecordAction(base::UserMetricsAction("SettingsResetPrompt_Shown"));
+ UMA_HISTOGRAM_BOOLEAN("SettingsResetPrompt.DialogShown", true);
}
void SettingsResetPromptController::Accept() {
+ DCHECK(!time_dialog_shown_.is_null());
+ base::RecordAction(base::UserMetricsAction("SettingsResetPrompt_Accepted"));
+ UMA_HISTOGRAM_LONG_TIMES_100("SettingsResetPrompt.TimeUntilAccepted",
+ base::Time::Now() - time_dialog_shown_);
+ UMA_HISTOGRAM_BOOLEAN("SettingsResetPrompt.PromptAccepted", true);
model_->PerformReset(
base::Bind(&SettingsResetPromptController::OnInteractionDone,
base::Unretained(this)));
}
void SettingsResetPromptController::Cancel() {
+ DCHECK(!time_dialog_shown_.is_null());
+ base::RecordAction(base::UserMetricsAction("SettingsResetPrompt_Declined"));
+ UMA_HISTOGRAM_LONG_TIMES_100("SettingsResetPrompt.TimeUntilDeclined",
+ base::Time::Now() - time_dialog_shown_);
+ UMA_HISTOGRAM_BOOLEAN("SettingsResetPrompt.PromptAccepted", false);
OnInteractionDone();
}
@@ -204,7 +225,6 @@ void SettingsResetPromptController::InitMainText() {
}
void SettingsResetPromptController::OnInteractionDone() {
- // TODO(alito): Add metrics reporting here.
delete this;
}

Powered by Google App Engine
This is Rietveld 408576698