Chromium Code Reviews| 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 |