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

Unified Diff: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.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_model.cc
diff --git a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.cc b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.cc
index d4025848575f2a05ac8bbc4c7e470622618f9f19..dd785834ac2753be94c5403749dec6d5b1ef8550 100644
--- a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.cc
+++ b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.cc
@@ -8,6 +8,7 @@
#include "base/bind_helpers.h"
#include "base/callback.h"
+#include "base/metrics/histogram_macros.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/google/google_brand.h"
#include "chrome/browser/prefs/session_startup_pref.h"
@@ -37,6 +38,15 @@ namespace {
constexpr char kOmahaUrl[] = "https://tools.google.com/service/update2";
#endif // defined(GOOGLE_CHROME_BUILD)
+// These values are used for UMA metrics reporting. New enum values can be
+// added, but existing enums must never be renumbered or deleted and reused.
+enum SettingsReset {
+ SETTINGS_RESET_HOMEPAGE = 1,
+ SETTINGS_RESET_DEFAULT_SEARCH = 2,
+ SETTINGS_RESET_STARTUP_URLS = 3,
+ SETTINGS_RESET_MAX,
+};
+
// Used to keep track of which settings types have been initialized in
// |SettingsResetPromptModel|.
enum SettingsType : uint32_t {
@@ -209,15 +219,28 @@ void SettingsResetPromptModel::PerformReset(
extension_service->DisableExtension(
extension_id, extensions::Extension::DISABLE_USER_ACTION);
}
+ UMA_HISTOGRAM_COUNTS_100("SettingsResetPrompt.NumberOfExtensionsDisabled",
+ extensions_to_disable().size());
// Disable all the settings that need to be reset.
ProfileResetter::ResettableFlags reset_flags = 0;
- if (homepage_reset_state() == RESET_REQUIRED)
+ if (homepage_reset_state() == RESET_REQUIRED) {
reset_flags |= ProfileResetter::HOMEPAGE;
- if (default_search_reset_state() == RESET_REQUIRED)
+ UMA_HISTOGRAM_ENUMERATION("SettingsResetPrompt.SettingsReset",
+ SETTINGS_RESET_HOMEPAGE, SETTINGS_RESET_MAX);
+ }
+ if (default_search_reset_state() == RESET_REQUIRED) {
reset_flags |= ProfileResetter::DEFAULT_SEARCH_ENGINE;
- if (startup_urls_reset_state() == RESET_REQUIRED)
+ UMA_HISTOGRAM_ENUMERATION("SettingsResetPrompt.SettingsReset",
+ SETTINGS_RESET_DEFAULT_SEARCH,
+ SETTINGS_RESET_MAX);
+ }
+ if (startup_urls_reset_state() == RESET_REQUIRED) {
reset_flags |= ProfileResetter::STARTUP_PAGES;
+ UMA_HISTOGRAM_ENUMERATION("SettingsResetPrompt.SettingsReset",
+ SETTINGS_RESET_STARTUP_URLS, SETTINGS_RESET_MAX);
+ }
+
profile_resetter_->Reset(reset_flags, std::move(default_settings_),
done_callback);
}
@@ -276,6 +299,22 @@ SettingsResetPromptModel::extensions_to_disable() const {
return extensions_to_disable_;
}
+void SettingsResetPromptModel::ReportUmaMetrics() const {
+ UMA_HISTOGRAM_BOOLEAN("SettingsResetPrompt.PromptRequired",
+ ShouldPromptForReset());
+ UMA_HISTOGRAM_ENUMERATION("SettingsResetPrompt.ResetState_DefaultSearch",
+ default_search_reset_state(), RESET_STATE_MAX);
+ UMA_HISTOGRAM_ENUMERATION("SettingsResetPrompt.ResetState_StartupUrls",
+ startup_urls_reset_state(), RESET_STATE_MAX);
+ UMA_HISTOGRAM_ENUMERATION("SettingsResetPrompt.ResetState_Homepage",
+ homepage_reset_state(), RESET_STATE_MAX);
+ UMA_HISTOGRAM_COUNTS_100("SettingsResetPrompt.NumberOfExtensionsToDisable",
+ extensions_to_disable().size());
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "SettingsResetPrompt.DelayBeforePromptParam",
+ prompt_config_->delay_before_prompt().InSeconds());
+}
+
// static
void SettingsResetPromptModel::OnSettingsFetched(
Profile* profile,
« no previous file with comments | « chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698