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

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

Issue 20722007: Only log HomePageIsNewTabPage if home button is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and reapply 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('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/prefs/session_startup_pref.h"
10 #include "chrome/browser/profiles/incognito_helpers.h" 10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
13 #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"
14 14
15 PrefMetricsService::PrefMetricsService(Profile* profile) 15 PrefMetricsService::PrefMetricsService(Profile* profile)
16 : profile_(profile) { 16 : profile_(profile) {
17 RecordLaunchPrefs(); 17 RecordLaunchPrefs();
18 } 18 }
19 19
20 PrefMetricsService::~PrefMetricsService() { 20 PrefMetricsService::~PrefMetricsService() {
21 } 21 }
22 22
23 void PrefMetricsService::RecordLaunchPrefs() { 23 void PrefMetricsService::RecordLaunchPrefs() {
24 UMA_HISTOGRAM_BOOLEAN("Settings.ShowHomeButton", 24 PrefService* prefs = profile_->GetPrefs();
25 profile_->GetPrefs()->GetBoolean(prefs::kShowHomeButton)); 25 bool showHomeButton = prefs->GetBoolean(prefs::kShowHomeButton);
26 UMA_HISTOGRAM_BOOLEAN("Settings.HomePageIsNewTabPage", 26 bool homePageIsNewTabPage = prefs->GetBoolean(prefs::kHomePageIsNewTabPage);
27 profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)); 27 UMA_HISTOGRAM_BOOLEAN("Settings.ShowHomeButton", showHomeButton);
28 28 if (showHomeButton) {
29 int restore_on_startup = profile_->GetPrefs()->GetInteger( 29 UMA_HISTOGRAM_BOOLEAN("Settings.HomePageIsNewTabPage",
30 prefs::kRestoreOnStartup); 30 homePageIsNewTabPage);
31 }
32 int restore_on_startup = prefs->GetInteger(prefs::kRestoreOnStartup);
31 UMA_HISTOGRAM_ENUMERATION("Settings.StartupPageLoadSettings", 33 UMA_HISTOGRAM_ENUMERATION("Settings.StartupPageLoadSettings",
32 restore_on_startup, SessionStartupPref::kPrefValueMax); 34 restore_on_startup, SessionStartupPref::kPrefValueMax);
33 if (restore_on_startup == SessionStartupPref::kPrefValueURLs) { 35 if (restore_on_startup == SessionStartupPref::kPrefValueURLs) {
34 const int url_list_size = profile_->GetPrefs()->GetList( 36 const int url_list_size = prefs->GetList(
35 prefs::kURLsToRestoreOnStartup)->GetSize(); 37 prefs::kURLsToRestoreOnStartup)->GetSize();
36 UMA_HISTOGRAM_CUSTOM_COUNTS( 38 UMA_HISTOGRAM_CUSTOM_COUNTS(
37 "Settings.StartupPageLoadURLs", url_list_size, 1, 50, 20); 39 "Settings.StartupPageLoadURLs", url_list_size, 1, 50, 20);
38 } 40 }
39 } 41 }
40 42
41 // static 43 // static
42 PrefMetricsService::Factory* PrefMetricsService::Factory::GetInstance() { 44 PrefMetricsService::Factory* PrefMetricsService::Factory::GetInstance() {
43 return Singleton<PrefMetricsService::Factory>::get(); 45 return Singleton<PrefMetricsService::Factory>::get();
44 } 46 }
(...skipping 25 matching lines...) Expand all
70 } 72 }
71 73
72 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { 74 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const {
73 return false; 75 return false;
74 } 76 }
75 77
76 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( 78 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse(
77 content::BrowserContext* context) const { 79 content::BrowserContext* context) const {
78 return chrome::GetBrowserContextRedirectedInIncognito(context); 80 return chrome::GetBrowserContextRedirectedInIncognito(context);
79 } 81 }
OLDNEW
« 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