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

Unified Diff: chrome/browser/prefs/pref_metrics_service.cc

Issue 20582004: Add histogram for pages to open enum on session restore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bbudge comments Created 7 years, 5 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/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_metrics_service.cc
diff --git a/chrome/browser/prefs/pref_metrics_service.cc b/chrome/browser/prefs/pref_metrics_service.cc
index ed1d5380e5849a2e828a2951ac73b4e25d494df8..79ae92e4ceb7665aa10badf06a7f638091bfa5ab 100644
--- a/chrome/browser/prefs/pref_metrics_service.cc
+++ b/chrome/browser/prefs/pref_metrics_service.cc
@@ -6,6 +6,7 @@
#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
+#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
@@ -19,11 +20,50 @@ PrefMetricsService::PrefMetricsService(Profile* profile)
PrefMetricsService::~PrefMetricsService() {
}
+enum StartupPagePref {
bbudge 2013/12/04 20:05:09 Also, since it's private to this file, could this
+ NONE = 0,
+ HOMEPAGE = 1,
+ NEWTAB = 2,
+ LAST = 3,
+ ZERO_URLS = 4,
+ ONE_URL = 5,
+ MULTIPLE_URLS = 6,
+ TYPE_COUNT = 7
+};
+
+StartupPagePref GetStartupPagePref(Profile* profile) {
+ int restore_on_startup =
+ profile->GetPrefs()->GetInteger(prefs::kRestoreOnStartup);
+ int url_list_size = 0;
+ switch (restore_on_startup) {
+ case SessionStartupPref::kPrefValueHomePage:
+ return HOMEPAGE;
+ case SessionStartupPref::kPrefValueLast:
+ return LAST;
+ case SessionStartupPref::kPrefValueNewTab:
+ return NEWTAB;
+ case SessionStartupPref::kPrefValueURLs:
+ url_list_size = profile->GetPrefs()->GetList(
+ prefs::kURLsToRestoreOnStartup)->GetSize();
+ if (url_list_size == 0) {
+ return ZERO_URLS;
+ } else if (url_list_size == 1) {
+ return ONE_URL;
+ } else {
+ return MULTIPLE_URLS;
+ }
+ default:
+ return NONE;
+ }
+}
+
void PrefMetricsService::RecordLaunchPrefs() {
UMA_HISTOGRAM_BOOLEAN("Settings.ShowHomeButton",
profile_->GetPrefs()->GetBoolean(prefs::kShowHomeButton));
UMA_HISTOGRAM_BOOLEAN("Settings.HomePageIsNewTabPage",
profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage));
+ UMA_HISTOGRAM_ENUMERATION("Settings.SessionRestoreOnStartup",
+ GetStartupPagePref(profile_), TYPE_COUNT);
}
// static
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698