OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/search_engines/template_url_service_factory.h" | 5 #include "chrome/browser/search_engines/template_url_service_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/google/google_url_tracker_factory.h" | 13 #include "chrome/browser/google/google_url_tracker_factory.h" |
14 #include "chrome/browser/history/history_service_factory.h" | 14 #include "chrome/browser/history/history_service_factory.h" |
15 #include "chrome/browser/profiles/incognito_helpers.h" | 15 #include "chrome/browser/profiles/incognito_helpers.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" | 17 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" |
18 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 18 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
19 #include "chrome/browser/web_data_service_factory.h" | 19 #include "chrome/browser/web_data_service_factory.h" |
20 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 20 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
21 #include "components/pref_registry/pref_registry_syncable.h" | 21 #include "components/pref_registry/pref_registry_syncable.h" |
22 #include "components/prefs/pref_service.h" | 22 #include "components/prefs/pref_service.h" |
23 #include "components/search_engines/default_search_manager.h" | 23 #include "components/search_engines/default_search_manager.h" |
24 #include "components/search_engines/search_engines_pref_names.h" | 24 #include "components/search_engines/search_engines_pref_names.h" |
25 #include "components/search_engines/template_url_service.h" | 25 #include "components/search_engines/template_url_service.h" |
| 26 #include "extensions/browser/extension_pref_value_map_factory.h" |
26 | 27 |
27 #if defined(ENABLE_RLZ) | 28 #if defined(ENABLE_RLZ) |
28 #include "components/rlz/rlz_tracker.h" | 29 #include "components/rlz/rlz_tracker.h" |
29 #endif | 30 #endif |
30 | 31 |
31 // static | 32 // static |
32 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { | 33 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { |
33 return static_cast<TemplateURLService*>( | 34 return static_cast<TemplateURLService*>( |
34 GetInstance()->GetServiceForBrowserContext(profile, true)); | 35 GetInstance()->GetServiceForBrowserContext(profile, true)); |
35 } | 36 } |
(...skipping 14 matching lines...) Expand all Loading... |
50 #endif | 51 #endif |
51 Profile* profile = static_cast<Profile*>(context); | 52 Profile* profile = static_cast<Profile*>(context); |
52 return base::MakeUnique<TemplateURLService>( | 53 return base::MakeUnique<TemplateURLService>( |
53 profile->GetPrefs(), | 54 profile->GetPrefs(), |
54 std::unique_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), | 55 std::unique_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), |
55 WebDataServiceFactory::GetKeywordWebDataForProfile( | 56 WebDataServiceFactory::GetKeywordWebDataForProfile( |
56 profile, ServiceAccessType::EXPLICIT_ACCESS), | 57 profile, ServiceAccessType::EXPLICIT_ACCESS), |
57 std::unique_ptr<TemplateURLServiceClient>( | 58 std::unique_ptr<TemplateURLServiceClient>( |
58 new ChromeTemplateURLServiceClient( | 59 new ChromeTemplateURLServiceClient( |
59 HistoryServiceFactory::GetForProfile( | 60 HistoryServiceFactory::GetForProfile( |
60 profile, ServiceAccessType::EXPLICIT_ACCESS))), | 61 profile, ServiceAccessType::EXPLICIT_ACCESS), |
| 62 ExtensionPrefValueMapFactory::GetForBrowserContext(context))), |
61 GoogleURLTrackerFactory::GetForProfile(profile), | 63 GoogleURLTrackerFactory::GetForProfile(profile), |
62 g_browser_process->rappor_service(), dsp_change_callback); | 64 g_browser_process->rappor_service(), dsp_change_callback); |
63 } | 65 } |
64 | 66 |
65 TemplateURLServiceFactory::TemplateURLServiceFactory() | 67 TemplateURLServiceFactory::TemplateURLServiceFactory() |
66 : BrowserContextKeyedServiceFactory( | 68 : BrowserContextKeyedServiceFactory( |
67 "TemplateURLServiceFactory", | 69 "TemplateURLServiceFactory", |
68 BrowserContextDependencyManager::GetInstance()) { | 70 BrowserContextDependencyManager::GetInstance()) { |
69 DependsOn(GoogleURLTrackerFactory::GetInstance()); | 71 DependsOn(GoogleURLTrackerFactory::GetInstance()); |
70 DependsOn(HistoryServiceFactory::GetInstance()); | 72 DependsOn(HistoryServiceFactory::GetInstance()); |
(...skipping 14 matching lines...) Expand all Loading... |
85 } | 87 } |
86 | 88 |
87 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( | 89 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( |
88 content::BrowserContext* context) const { | 90 content::BrowserContext* context) const { |
89 return chrome::GetBrowserContextRedirectedInIncognito(context); | 91 return chrome::GetBrowserContextRedirectedInIncognito(context); |
90 } | 92 } |
91 | 93 |
92 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { | 94 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { |
93 return true; | 95 return true; |
94 } | 96 } |
OLD | NEW |