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

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

Issue 19776015: Add UMA stat to track home button and page prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for real Created 7 years, 5 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 | « chrome/browser/prefs/pref_metrics_service.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/prefs/pref_metrics_service.h"
6
7 #include "base/metrics/histogram.h"
8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/common/pref_names.h"
12 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
13
14 PrefMetricsService::PrefMetricsService(Profile* profile)
15 : profile_(profile) {
16 RecordLaunchPrefs();
17 }
18
19 PrefMetricsService::~PrefMetricsService() {
20 }
21
22 void PrefMetricsService::RecordLaunchPrefs() {
23 UMA_HISTOGRAM_BOOLEAN("Settings.ShowHomeButton",
24 profile_->GetPrefs()->GetBoolean(prefs::kShowHomeButton));
25 UMA_HISTOGRAM_BOOLEAN("Settings.HomePageIsNewTabPage",
26 profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage));
27 }
28
29 // static
30 PrefMetricsService::Factory* PrefMetricsService::Factory::GetInstance() {
31 return Singleton<PrefMetricsService::Factory>::get();
32 }
33
34 // static
35 PrefMetricsService* PrefMetricsService::Factory::GetForProfile(
36 Profile* profile) {
37 return static_cast<PrefMetricsService*>(
38 GetInstance()->GetServiceForBrowserContext(profile, true));
39 }
40
41 PrefMetricsService::Factory::Factory()
42 : BrowserContextKeyedServiceFactory(
43 "PrefMetricsService",
44 BrowserContextDependencyManager::GetInstance()) {
45 }
46
47 PrefMetricsService::Factory::~Factory() {
48 }
49
50 BrowserContextKeyedService*
51 PrefMetricsService::Factory::BuildServiceInstanceFor(
52 content::BrowserContext* profile) const {
53 return new PrefMetricsService(static_cast<Profile*>(profile));
54 }
55
56 bool PrefMetricsService::Factory::ServiceIsCreatedWithBrowserContext() const {
57 return true;
58 }
59
60 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const {
61 return false;
62 }
63
64 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse(
65 content::BrowserContext* context) const {
66 return chrome::GetBrowserContextRedirectedInIncognito(context);
67 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_metrics_service.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698