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/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/metrics/rappor/sampling.h" | 15 #include "chrome/browser/metrics/rappor/sampling.h" |
16 #include "chrome/browser/prefs/pref_service_syncable.h" | 16 #include "chrome/browser/prefs/pref_service_syncable.h" |
17 #include "chrome/browser/prefs/session_startup_pref.h" | 17 #include "chrome/browser/prefs/session_startup_pref.h" |
18 #include "chrome/browser/prefs/synced_pref_change_registrar.h" | 18 #include "chrome/browser/prefs/synced_pref_change_registrar.h" |
19 #include "chrome/browser/profiles/incognito_helpers.h" | 19 #include "chrome/browser/profiles/incognito_helpers.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/search_engines/template_url_service_factory.h" |
21 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 22 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
24 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
25 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 26 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
26 #include "components/search_engines/template_url_prepopulate_data.h" | 27 #include "components/search_engines/template_url_prepopulate_data.h" |
27 #include "content/public/browser/browser_url_handler.h" | 28 #include "content/public/browser/browser_url_handler.h" |
28 #include "crypto/hmac.h" | 29 #include "crypto/hmac.h" |
29 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 30 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
30 | 31 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 PrefMetricsService* PrefMetricsService::Factory::GetForProfile( | 217 PrefMetricsService* PrefMetricsService::Factory::GetForProfile( |
217 Profile* profile) { | 218 Profile* profile) { |
218 return static_cast<PrefMetricsService*>( | 219 return static_cast<PrefMetricsService*>( |
219 GetInstance()->GetServiceForBrowserContext(profile, true)); | 220 GetInstance()->GetServiceForBrowserContext(profile, true)); |
220 } | 221 } |
221 | 222 |
222 PrefMetricsService::Factory::Factory() | 223 PrefMetricsService::Factory::Factory() |
223 : BrowserContextKeyedServiceFactory( | 224 : BrowserContextKeyedServiceFactory( |
224 "PrefMetricsService", | 225 "PrefMetricsService", |
225 BrowserContextDependencyManager::GetInstance()) { | 226 BrowserContextDependencyManager::GetInstance()) { |
| 227 DependsOn(TemplateURLServiceFactory::GetInstance()); |
226 } | 228 } |
227 | 229 |
228 PrefMetricsService::Factory::~Factory() { | 230 PrefMetricsService::Factory::~Factory() { |
229 } | 231 } |
230 | 232 |
231 KeyedService* PrefMetricsService::Factory::BuildServiceInstanceFor( | 233 KeyedService* PrefMetricsService::Factory::BuildServiceInstanceFor( |
232 content::BrowserContext* profile) const { | 234 content::BrowserContext* profile) const { |
233 return new PrefMetricsService(static_cast<Profile*>(profile)); | 235 return new PrefMetricsService(static_cast<Profile*>(profile)); |
234 } | 236 } |
235 | 237 |
236 bool PrefMetricsService::Factory::ServiceIsCreatedWithBrowserContext() const { | 238 bool PrefMetricsService::Factory::ServiceIsCreatedWithBrowserContext() const { |
237 return true; | 239 return true; |
238 } | 240 } |
239 | 241 |
240 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { | 242 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { |
241 return false; | 243 return false; |
242 } | 244 } |
243 | 245 |
244 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( | 246 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( |
245 content::BrowserContext* context) const { | 247 content::BrowserContext* context) const { |
246 return chrome::GetBrowserContextRedirectedInIncognito(context); | 248 return chrome::GetBrowserContextRedirectedInIncognito(context); |
247 } | 249 } |
OLD | NEW |