OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/prefs/pref_metrics_service.h" | 5 #include "chrome/browser/prefs/pref_metrics_service.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/prefs/session_startup_pref.h" |
9 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
12 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 13 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
13 | 14 |
14 PrefMetricsService::PrefMetricsService(Profile* profile) | 15 PrefMetricsService::PrefMetricsService(Profile* profile) |
15 : profile_(profile) { | 16 : profile_(profile) { |
16 RecordLaunchPrefs(); | 17 RecordLaunchPrefs(); |
17 } | 18 } |
18 | 19 |
19 PrefMetricsService::~PrefMetricsService() { | 20 PrefMetricsService::~PrefMetricsService() { |
20 } | 21 } |
21 | 22 |
22 void PrefMetricsService::RecordLaunchPrefs() { | 23 void PrefMetricsService::RecordLaunchPrefs() { |
23 UMA_HISTOGRAM_BOOLEAN("Settings.ShowHomeButton", | 24 UMA_HISTOGRAM_BOOLEAN("Settings.ShowHomeButton", |
24 profile_->GetPrefs()->GetBoolean(prefs::kShowHomeButton)); | 25 profile_->GetPrefs()->GetBoolean(prefs::kShowHomeButton)); |
25 UMA_HISTOGRAM_BOOLEAN("Settings.HomePageIsNewTabPage", | 26 UMA_HISTOGRAM_BOOLEAN("Settings.HomePageIsNewTabPage", |
26 profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)); | 27 profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)); |
| 28 |
| 29 int restore_on_startup = profile_->GetPrefs()->GetInteger( |
| 30 prefs::kRestoreOnStartup); |
| 31 UMA_HISTOGRAM_ENUMERATION("Settings.StartupPageLoadSettings", |
| 32 restore_on_startup, SessionStartupPref::kPrefValueMax); |
| 33 if (restore_on_startup == SessionStartupPref::kPrefValueURLs) { |
| 34 const int url_list_size = profile_->GetPrefs()->GetList( |
| 35 prefs::kURLsToRestoreOnStartup)->GetSize(); |
| 36 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 37 "Settings.StartupPageLoadURLs", url_list_size, 1, 50, 20); |
| 38 } |
27 } | 39 } |
28 | 40 |
29 // static | 41 // static |
30 PrefMetricsService::Factory* PrefMetricsService::Factory::GetInstance() { | 42 PrefMetricsService::Factory* PrefMetricsService::Factory::GetInstance() { |
31 return Singleton<PrefMetricsService::Factory>::get(); | 43 return Singleton<PrefMetricsService::Factory>::get(); |
32 } | 44 } |
33 | 45 |
34 // static | 46 // static |
35 PrefMetricsService* PrefMetricsService::Factory::GetForProfile( | 47 PrefMetricsService* PrefMetricsService::Factory::GetForProfile( |
36 Profile* profile) { | 48 Profile* profile) { |
(...skipping 21 matching lines...) Expand all Loading... |
58 } | 70 } |
59 | 71 |
60 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { | 72 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { |
61 return false; | 73 return false; |
62 } | 74 } |
63 | 75 |
64 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( | 76 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( |
65 content::BrowserContext* context) const { | 77 content::BrowserContext* context) const { |
66 return chrome::GetBrowserContextRedirectedInIncognito(context); | 78 return chrome::GetBrowserContextRedirectedInIncognito(context); |
67 } | 79 } |
OLD | NEW |