OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/browser_shutdown.h" | 14 #include "chrome/browser/browser_shutdown.h" |
15 #include "chrome/browser/prefs/pref_service_syncable.h" | 15 #include "chrome/browser/prefs/pref_service_syncable.h" |
16 #include "chrome/browser/prefs/session_startup_pref.h" | 16 #include "chrome/browser/prefs/session_startup_pref.h" |
17 #include "chrome/browser/prefs/synced_pref_change_registrar.h" | 17 #include "chrome/browser/prefs/synced_pref_change_registrar.h" |
18 #include "chrome/browser/profiles/incognito_helpers.h" | 18 #include "chrome/browser/profiles/incognito_helpers.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 20 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
21 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 21 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
24 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 24 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 25 #include "components/rappor/rappor_service.h" |
25 #include "crypto/hmac.h" | 26 #include "crypto/hmac.h" |
26 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 27 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 const int kSessionStartupPrefValueMax = SessionStartupPref::kPrefValueMax; | 31 const int kSessionStartupPrefValueMax = SessionStartupPref::kPrefValueMax; |
31 | 32 |
32 } // namespace | 33 } // namespace |
33 | 34 |
34 PrefMetricsService::PrefMetricsService(Profile* profile) | 35 PrefMetricsService::PrefMetricsService(Profile* profile) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // consist of a search box that sends to known TLD+1 Y) and false positives | 72 // consist of a search box that sends to known TLD+1 Y) and false positives |
72 // (pages that share a TLD+1 with a known engine but aren't actually search | 73 // (pages that share a TLD+1 with a known engine but aren't actually search |
73 // pages, e.g. plus.google.com). | 74 // pages, e.g. plus.google.com). |
74 if (!home_page_is_ntp) { | 75 if (!home_page_is_ntp) { |
75 GURL homepage_url(prefs_->GetString(prefs::kHomePage)); | 76 GURL homepage_url(prefs_->GetString(prefs::kHomePage)); |
76 if (homepage_url.is_valid()) { | 77 if (homepage_url.is_valid()) { |
77 UMA_HISTOGRAM_ENUMERATION( | 78 UMA_HISTOGRAM_ENUMERATION( |
78 "Settings.HomePageEngineType", | 79 "Settings.HomePageEngineType", |
79 TemplateURLPrepopulateData::GetEngineType(homepage_url), | 80 TemplateURLPrepopulateData::GetEngineType(homepage_url), |
80 SEARCH_ENGINE_MAX); | 81 SEARCH_ENGINE_MAX); |
| 82 g_browser_process->rappor_service()->RecordSample( |
| 83 "Settings.HomePage", |
| 84 rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, |
| 85 net::registry_controlled_domains::GetDomainAndRegistry(homepage_url, |
| 86 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); |
81 } | 87 } |
82 } | 88 } |
83 | 89 |
84 int restore_on_startup = prefs_->GetInteger(prefs::kRestoreOnStartup); | 90 int restore_on_startup = prefs_->GetInteger(prefs::kRestoreOnStartup); |
85 UMA_HISTOGRAM_ENUMERATION("Settings.StartupPageLoadSettings", | 91 UMA_HISTOGRAM_ENUMERATION("Settings.StartupPageLoadSettings", |
86 restore_on_startup, kSessionStartupPrefValueMax); | 92 restore_on_startup, kSessionStartupPrefValueMax); |
87 if (restore_on_startup == SessionStartupPref::kPrefValueURLs) { | 93 if (restore_on_startup == SessionStartupPref::kPrefValueURLs) { |
88 const base::ListValue* url_list = | 94 const base::ListValue* url_list = |
89 prefs_->GetList(prefs::kURLsToRestoreOnStartup); | 95 prefs_->GetList(prefs::kURLsToRestoreOnStartup); |
90 UMA_HISTOGRAM_CUSTOM_COUNTS("Settings.StartupPageLoadURLs", | 96 UMA_HISTOGRAM_CUSTOM_COUNTS("Settings.StartupPageLoadURLs", |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 221 } |
216 | 222 |
217 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { | 223 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { |
218 return false; | 224 return false; |
219 } | 225 } |
220 | 226 |
221 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( | 227 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( |
222 content::BrowserContext* context) const { | 228 content::BrowserContext* context) const { |
223 return chrome::GetBrowserContextRedirectedInIncognito(context); | 229 return chrome::GetBrowserContextRedirectedInIncognito(context); |
224 } | 230 } |
OLD | NEW |