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..80d97e11f39bb151d585c1c787cfcd2608eedbf1 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,53 @@ PrefMetricsService::PrefMetricsService(Profile* profile) |
| PrefMetricsService::~PrefMetricsService() { |
| } |
| +class StartupPagePref { |
|
bbudge
2013/07/27 10:49:06
Why not just declare an enum named StartupPagePref
meacer
2013/07/30 00:37:55
Done.
|
| + public: |
| + enum Type { |
| + NONE = 0, |
| + HOMEPAGE = 1, |
| + NEWTAB = 2, |
| + LAST = 3, |
| + NO_URL = 4, |
|
bbudge
2013/07/27 10:49:06
ZERO_URLS ?
meacer
2013/07/30 00:37:55
Done.
|
| + ONE_URL = 5, |
| + MULTIPLE_URLS = 6, |
| + TYPE_COUNT = 7 |
| + }; |
| +}; |
| + |
| +StartupPagePref::Type 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 StartupPagePref::HOMEPAGE; |
| + case SessionStartupPref::kPrefValueLast: |
| + return StartupPagePref::LAST; |
| + case SessionStartupPref::kPrefValueNewTab: |
| + return StartupPagePref::NEWTAB; |
| + case SessionStartupPref::kPrefValueURLs: |
| + url_list_size = profile->GetPrefs()->GetList( |
| + prefs::kURLsToRestoreOnStartup)->GetSize(); |
| + if (url_list_size == 0) { |
| + return StartupPagePref::NO_URL; |
| + } else if (url_list_size == 1) { |
| + return StartupPagePref::ONE_URL; |
| + } else { |
| + return StartupPagePref::MULTIPLE_URLS; |
| + } |
| + default: |
| + return StartupPagePref::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_), StartupPagePref::TYPE_COUNT); |
| } |
| // static |