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 "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/search_engines/default_search_manager.h" | 22 #include "components/search_engines/default_search_manager.h" |
| 23 #include "components/search_engines/desktop_search_utils.h" |
23 #include "components/search_engines/search_engines_pref_names.h" | 24 #include "components/search_engines/search_engines_pref_names.h" |
24 #include "components/search_engines/template_url_service.h" | 25 #include "components/search_engines/template_url_service.h" |
25 | 26 |
26 #if defined(OS_WIN) | |
27 #include "components/search_engines/desktop_search_win.h" | |
28 #endif // defined(OS_WIN) | |
29 | |
30 #if defined(ENABLE_RLZ) | 27 #if defined(ENABLE_RLZ) |
31 #include "components/rlz/rlz_tracker.h" | 28 #include "components/rlz/rlz_tracker.h" |
32 #endif | 29 #endif |
33 | 30 |
34 // static | 31 // static |
35 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { | 32 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { |
36 return static_cast<TemplateURLService*>( | 33 return static_cast<TemplateURLService*>( |
37 GetInstance()->GetServiceForBrowserContext(profile, true)); | 34 GetInstance()->GetServiceForBrowserContext(profile, true)); |
38 } | 35 } |
39 | 36 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 74 |
78 KeyedService* TemplateURLServiceFactory::BuildServiceInstanceFor( | 75 KeyedService* TemplateURLServiceFactory::BuildServiceInstanceFor( |
79 content::BrowserContext* profile) const { | 76 content::BrowserContext* profile) const { |
80 return BuildInstanceFor(static_cast<Profile*>(profile)).release(); | 77 return BuildInstanceFor(static_cast<Profile*>(profile)).release(); |
81 } | 78 } |
82 | 79 |
83 void TemplateURLServiceFactory::RegisterProfilePrefs( | 80 void TemplateURLServiceFactory::RegisterProfilePrefs( |
84 user_prefs::PrefRegistrySyncable* registry) { | 81 user_prefs::PrefRegistrySyncable* registry) { |
85 DefaultSearchManager::RegisterProfilePrefs(registry); | 82 DefaultSearchManager::RegisterProfilePrefs(registry); |
86 TemplateURLService::RegisterProfilePrefs(registry); | 83 TemplateURLService::RegisterProfilePrefs(registry); |
87 #if defined(OS_WIN) | 84 RegisterDesktopSearchRedirectionPref(registry); |
88 RegisterWindowsDesktopSearchRedirectionPref(registry); | |
89 #endif | |
90 } | 85 } |
91 | 86 |
92 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( | 87 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( |
93 content::BrowserContext* context) const { | 88 content::BrowserContext* context) const { |
94 return chrome::GetBrowserContextRedirectedInIncognito(context); | 89 return chrome::GetBrowserContextRedirectedInIncognito(context); |
95 } | 90 } |
96 | 91 |
97 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { | 92 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { |
98 return true; | 93 return true; |
99 } | 94 } |
OLD | NEW |