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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 : profile_(profile), | 72 : profile_(profile), |
73 prefs_(profile->GetPrefs()), | 73 prefs_(profile->GetPrefs()), |
74 local_state_(local_state), | 74 local_state_(local_state), |
75 weak_factory_(this) { | 75 weak_factory_(this) { |
76 } | 76 } |
77 | 77 |
78 PrefMetricsService::~PrefMetricsService() { | 78 PrefMetricsService::~PrefMetricsService() { |
79 } | 79 } |
80 | 80 |
81 void PrefMetricsService::RecordLaunchPrefs() { | 81 void PrefMetricsService::RecordLaunchPrefs() { |
82 #if !defined(OS_ANDROID) | |
82 bool show_home_button = prefs_->GetBoolean(prefs::kShowHomeButton); | 83 bool show_home_button = prefs_->GetBoolean(prefs::kShowHomeButton); |
83 bool home_page_is_ntp = prefs_->GetBoolean(prefs::kHomePageIsNewTabPage); | 84 bool home_page_is_ntp = prefs_->GetBoolean(prefs::kHomePageIsNewTabPage); |
84 UMA_HISTOGRAM_BOOLEAN("Settings.ShowHomeButton", show_home_button); | 85 UMA_HISTOGRAM_BOOLEAN("Settings.ShowHomeButton", show_home_button); |
85 if (show_home_button) { | 86 if (show_home_button) { |
86 UMA_HISTOGRAM_BOOLEAN("Settings.GivenShowHomeButton_HomePageIsNewTabPage", | 87 UMA_HISTOGRAM_BOOLEAN("Settings.GivenShowHomeButton_HomePageIsNewTabPage", |
87 home_page_is_ntp); | 88 home_page_is_ntp); |
88 } | 89 } |
89 | 90 |
90 // For non-NTP homepages, see if the URL comes from the same TLD+1 as a known | 91 // For non-NTP homepages, see if the URL comes from the same TLD+1 as a known |
91 // search engine. Note that this is only an approximation of search engine | 92 // search engine. Note that this is only an approximation of search engine |
92 // use, due to both false negatives (pages that come from unknown TLD+1 X but | 93 // use, due to both false negatives (pages that come from unknown TLD+1 X but |
93 // consist of a search box that sends to known TLD+1 Y) and false positives | 94 // consist of a search box that sends to known TLD+1 Y) and false positives |
94 // (pages that share a TLD+1 with a known engine but aren't actually search | 95 // (pages that share a TLD+1 with a known engine but aren't actually search |
95 // pages, e.g. plus.google.com). Additionally, record the TLD+1 of non-NTP | 96 // pages, e.g. plus.google.com). Additionally, record the TLD+1 of non-NTP |
96 // homepages through the privacy-preserving Rappor service. | 97 // homepages through the privacy-preserving Rappor service. |
97 if (!home_page_is_ntp) { | 98 if (!home_page_is_ntp) { |
98 GURL homepage_url(prefs_->GetString(prefs::kHomePage)); | 99 GURL homepage_url(prefs_->GetString(prefs::kHomePage)); |
99 if (homepage_url.is_valid()) { | 100 if (homepage_url.is_valid()) { |
100 UMA_HISTOGRAM_ENUMERATION( | 101 UMA_HISTOGRAM_ENUMERATION( |
101 "Settings.HomePageEngineType", | 102 "Settings.HomePageEngineType", |
102 TemplateURLPrepopulateData::GetEngineType(homepage_url), | 103 TemplateURLPrepopulateData::GetEngineType(homepage_url), |
103 SEARCH_ENGINE_MAX); | 104 SEARCH_ENGINE_MAX); |
104 rappor::SampleDomainAndRegistryFromGURL( | 105 rappor::SampleDomainAndRegistryFromGURL( |
105 g_browser_process->rappor_service(), "Settings.HomePage2", | 106 g_browser_process->rappor_service(), "Settings.HomePage2", |
106 homepage_url); | 107 homepage_url); |
107 } | 108 } |
108 } | 109 } |
110 #endif | |
109 | 111 |
110 SampleNewTabPageURL(profile_); | 112 SampleNewTabPageURL(profile_); |
Mark P
2016/05/24 04:31:26
Is this appropriate for Android? (chrome::kChrome
Ted C
2016/05/24 16:53:15
We don't allow overriding the new tab URL on Andro
| |
111 | 113 |
112 int restore_on_startup = prefs_->GetInteger(prefs::kRestoreOnStartup); | 114 int restore_on_startup = prefs_->GetInteger(prefs::kRestoreOnStartup); |
Mark P
2016/05/24 04:31:26
And this whole block here for that matter?
Ted C
2016/05/24 16:53:15
We also don't use desktop restore either, but I'm
| |
113 UMA_HISTOGRAM_ENUMERATION("Settings.StartupPageLoadSettings", | 115 UMA_HISTOGRAM_ENUMERATION("Settings.StartupPageLoadSettings", |
114 restore_on_startup, kSessionStartupPrefValueMax); | 116 restore_on_startup, kSessionStartupPrefValueMax); |
115 if (restore_on_startup == SessionStartupPref::kPrefValueURLs) { | 117 if (restore_on_startup == SessionStartupPref::kPrefValueURLs) { |
116 const base::ListValue* url_list = | 118 const base::ListValue* url_list = |
117 prefs_->GetList(prefs::kURLsToRestoreOnStartup); | 119 prefs_->GetList(prefs::kURLsToRestoreOnStartup); |
118 UMA_HISTOGRAM_CUSTOM_COUNTS("Settings.StartupPageLoadURLs", | 120 UMA_HISTOGRAM_CUSTOM_COUNTS("Settings.StartupPageLoadURLs", |
119 url_list->GetSize(), 1, 50, 20); | 121 url_list->GetSize(), 1, 50, 20); |
120 // Similarly, check startup pages for known search engine TLD+1s. | 122 // Similarly, check startup pages for known search engine TLD+1s. |
121 std::string url_text; | 123 std::string url_text; |
122 for (size_t i = 0; i < url_list->GetSize(); ++i) { | 124 for (size_t i = 0; i < url_list->GetSize(); ++i) { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 } | 251 } |
250 | 252 |
251 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { | 253 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { |
252 return false; | 254 return false; |
253 } | 255 } |
254 | 256 |
255 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( | 257 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( |
256 content::BrowserContext* context) const { | 258 content::BrowserContext* context) const { |
257 return chrome::GetBrowserContextRedirectedInIncognito(context); | 259 return chrome::GetBrowserContextRedirectedInIncognito(context); |
258 } | 260 } |
OLD | NEW |