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

Side by Side Diff: chrome/browser/prefs/pref_metrics_service.cc

Issue 21130008: Merge 214426 "Add histograms for session startup enum and number..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1547/src/
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/prefs/session_startup_pref.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prefs/session_startup_pref.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698