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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/google/google_url_tracker_factory.h" | 12 #include "chrome/browser/google/google_url_tracker_factory.h" |
13 #include "chrome/browser/history/history_service_factory.h" | 13 #include "chrome/browser/history/history_service_factory.h" |
14 #include "chrome/browser/profiles/incognito_helpers.h" | 14 #include "chrome/browser/profiles/incognito_helpers.h" |
| 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/rlz/rlz.h" | 16 #include "chrome/browser/rlz/rlz.h" |
16 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" | 17 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" |
17 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 18 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
18 #include "chrome/browser/webdata/web_data_service_factory.h" | 19 #include "chrome/browser/webdata/web_data_service_factory.h" |
19 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 20 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
20 #include "components/pref_registry/pref_registry_syncable.h" | 21 #include "components/pref_registry/pref_registry_syncable.h" |
21 #include "components/search_engines/default_search_manager.h" | 22 #include "components/search_engines/default_search_manager.h" |
22 #include "components/search_engines/search_engines_pref_names.h" | 23 #include "components/search_engines/search_engines_pref_names.h" |
23 #include "components/search_engines/template_url_service.h" | 24 #include "components/search_engines/template_url_service.h" |
24 | 25 |
(...skipping 17 matching lines...) Expand all Loading... |
42 base::Bind(base::IgnoreResult(&RLZTracker::RecordProductEvent), | 43 base::Bind(base::IgnoreResult(&RLZTracker::RecordProductEvent), |
43 rlz_lib::CHROME, | 44 rlz_lib::CHROME, |
44 RLZTracker::ChromeOmnibox(), | 45 RLZTracker::ChromeOmnibox(), |
45 rlz_lib::SET_TO_GOOGLE); | 46 rlz_lib::SET_TO_GOOGLE); |
46 #endif | 47 #endif |
47 Profile* profile = static_cast<Profile*>(context); | 48 Profile* profile = static_cast<Profile*>(context); |
48 return new TemplateURLService( | 49 return new TemplateURLService( |
49 profile->GetPrefs(), | 50 profile->GetPrefs(), |
50 scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), | 51 scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), |
51 WebDataServiceFactory::GetKeywordWebDataForProfile( | 52 WebDataServiceFactory::GetKeywordWebDataForProfile( |
52 profile, Profile::EXPLICIT_ACCESS), | 53 profile, ServiceAccessType::EXPLICIT_ACCESS), |
53 scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( | 54 scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( |
54 HistoryServiceFactory::GetForProfile(profile, | 55 HistoryServiceFactory::GetForProfile( |
55 Profile::EXPLICIT_ACCESS))), | 56 profile, ServiceAccessType::EXPLICIT_ACCESS))), |
56 GoogleURLTrackerFactory::GetForProfile(profile), | 57 GoogleURLTrackerFactory::GetForProfile(profile), |
57 g_browser_process->rappor_service(), | 58 g_browser_process->rappor_service(), |
58 dsp_change_callback); | 59 dsp_change_callback); |
59 } | 60 } |
60 | 61 |
61 TemplateURLServiceFactory::TemplateURLServiceFactory() | 62 TemplateURLServiceFactory::TemplateURLServiceFactory() |
62 : BrowserContextKeyedServiceFactory( | 63 : BrowserContextKeyedServiceFactory( |
63 "TemplateURLServiceFactory", | 64 "TemplateURLServiceFactory", |
64 BrowserContextDependencyManager::GetInstance()) { | 65 BrowserContextDependencyManager::GetInstance()) { |
65 DependsOn(GoogleURLTrackerFactory::GetInstance()); | 66 DependsOn(GoogleURLTrackerFactory::GetInstance()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 154 } |
154 | 155 |
155 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( | 156 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( |
156 content::BrowserContext* context) const { | 157 content::BrowserContext* context) const { |
157 return chrome::GetBrowserContextRedirectedInIncognito(context); | 158 return chrome::GetBrowserContextRedirectedInIncognito(context); |
158 } | 159 } |
159 | 160 |
160 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { | 161 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { |
161 return true; | 162 return true; |
162 } | 163 } |
OLD | NEW |