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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/prefs/pref_service_syncable.h" | 21 #include "chrome/browser/prefs/pref_service_syncable.h" |
22 #include "chrome/browser/prefs/session_startup_pref.h" | 22 #include "chrome/browser/prefs/session_startup_pref.h" |
23 #include "chrome/browser/prefs/synced_pref_change_registrar.h" | 23 #include "chrome/browser/prefs/synced_pref_change_registrar.h" |
24 #include "chrome/browser/profiles/incognito_helpers.h" | 24 #include "chrome/browser/profiles/incognito_helpers.h" |
25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 26 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
27 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 27 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
30 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 30 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 31 #include "components/rappor/rappor_recorder.h" |
| 32 #include "components/rappor/rappor_utils.h" |
31 #include "crypto/hmac.h" | 33 #include "crypto/hmac.h" |
32 #include "grit/browser_resources.h" | 34 #include "grit/browser_resources.h" |
33 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 35 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
34 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
35 | 37 |
36 namespace { | 38 namespace { |
37 | 39 |
38 const int kSessionStartupPrefValueMax = SessionStartupPref::kPrefValueMax; | 40 const int kSessionStartupPrefValueMax = SessionStartupPref::kPrefValueMax; |
39 | 41 |
40 #if defined(OS_ANDROID) | 42 #if defined(OS_ANDROID) |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // consist of a search box that sends to known TLD+1 Y) and false positives | 146 // consist of a search box that sends to known TLD+1 Y) and false positives |
145 // (pages that share a TLD+1 with a known engine but aren't actually search | 147 // (pages that share a TLD+1 with a known engine but aren't actually search |
146 // pages, e.g. plus.google.com). | 148 // pages, e.g. plus.google.com). |
147 if (!home_page_is_ntp) { | 149 if (!home_page_is_ntp) { |
148 GURL homepage_url(prefs_->GetString(prefs::kHomePage)); | 150 GURL homepage_url(prefs_->GetString(prefs::kHomePage)); |
149 if (homepage_url.is_valid()) { | 151 if (homepage_url.is_valid()) { |
150 UMA_HISTOGRAM_ENUMERATION( | 152 UMA_HISTOGRAM_ENUMERATION( |
151 "Settings.HomePageEngineType", | 153 "Settings.HomePageEngineType", |
152 TemplateURLPrepopulateData::GetEngineType(homepage_url), | 154 TemplateURLPrepopulateData::GetEngineType(homepage_url), |
153 SEARCH_ENGINE_MAX); | 155 SEARCH_ENGINE_MAX); |
| 156 std::vector<std::string> url_parts; |
| 157 rappor::GetUrlParts(homepage_url, &url_parts); |
| 158 RAPPOR_SAMPLES("Settings.HomePage", url_parts); |
154 } | 159 } |
155 } | 160 } |
156 | 161 |
157 int restore_on_startup = prefs_->GetInteger(prefs::kRestoreOnStartup); | 162 int restore_on_startup = prefs_->GetInteger(prefs::kRestoreOnStartup); |
158 UMA_HISTOGRAM_ENUMERATION("Settings.StartupPageLoadSettings", | 163 UMA_HISTOGRAM_ENUMERATION("Settings.StartupPageLoadSettings", |
159 restore_on_startup, kSessionStartupPrefValueMax); | 164 restore_on_startup, kSessionStartupPrefValueMax); |
160 if (restore_on_startup == SessionStartupPref::kPrefValueURLs) { | 165 if (restore_on_startup == SessionStartupPref::kPrefValueURLs) { |
161 const ListValue* url_list = prefs_->GetList(prefs::kURLsToRestoreOnStartup); | 166 const ListValue* url_list = prefs_->GetList(prefs::kURLsToRestoreOnStartup); |
162 UMA_HISTOGRAM_CUSTOM_COUNTS("Settings.StartupPageLoadURLs", | 167 UMA_HISTOGRAM_CUSTOM_COUNTS("Settings.StartupPageLoadURLs", |
163 url_list->GetSize(), 1, 50, 20); | 168 url_list->GetSize(), 1, 50, 20); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 475 } |
471 | 476 |
472 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { | 477 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { |
473 return false; | 478 return false; |
474 } | 479 } |
475 | 480 |
476 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( | 481 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( |
477 content::BrowserContext* context) const { | 482 content::BrowserContext* context) const { |
478 return chrome::GetBrowserContextRedirectedInIncognito(context); | 483 return chrome::GetBrowserContextRedirectedInIncognito(context); |
479 } | 484 } |
OLD | NEW |