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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/google/google_url_tracker_factory.h" | 10 #include "chrome/browser/google/google_url_tracker_factory.h" |
11 #include "chrome/browser/history/history_service_factory.h" | 11 #include "chrome/browser/history/history_service_factory.h" |
12 #include "chrome/browser/profiles/incognito_helpers.h" | 12 #include "chrome/browser/profiles/incognito_helpers.h" |
13 #include "chrome/browser/search_engines/default_search_manager.h" | |
14 #include "chrome/browser/search_engines/template_url_service.h" | 13 #include "chrome/browser/search_engines/template_url_service.h" |
15 #include "chrome/browser/webdata/web_data_service_factory.h" | 14 #include "chrome/browser/webdata/web_data_service_factory.h" |
16 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
17 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 16 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
18 #include "components/user_prefs/pref_registry_syncable.h" | 17 #include "components/user_prefs/pref_registry_syncable.h" |
19 | 18 |
20 // static | 19 // static |
21 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { | 20 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { |
22 return static_cast<TemplateURLService*>( | 21 return static_cast<TemplateURLService*>( |
23 GetInstance()->GetServiceForBrowserContext(profile, true)); | 22 GetInstance()->GetServiceForBrowserContext(profile, true)); |
(...skipping 21 matching lines...) Expand all Loading... |
45 | 44 |
46 TemplateURLServiceFactory::~TemplateURLServiceFactory() {} | 45 TemplateURLServiceFactory::~TemplateURLServiceFactory() {} |
47 | 46 |
48 KeyedService* TemplateURLServiceFactory::BuildServiceInstanceFor( | 47 KeyedService* TemplateURLServiceFactory::BuildServiceInstanceFor( |
49 content::BrowserContext* profile) const { | 48 content::BrowserContext* profile) const { |
50 return BuildInstanceFor(static_cast<Profile*>(profile)); | 49 return BuildInstanceFor(static_cast<Profile*>(profile)); |
51 } | 50 } |
52 | 51 |
53 void TemplateURLServiceFactory::RegisterProfilePrefs( | 52 void TemplateURLServiceFactory::RegisterProfilePrefs( |
54 user_prefs::PrefRegistrySyncable* registry) { | 53 user_prefs::PrefRegistrySyncable* registry) { |
55 DefaultSearchManager::RegisterProfilePrefs(registry); | |
56 registry->RegisterStringPref(prefs::kSyncedDefaultSearchProviderGUID, | 54 registry->RegisterStringPref(prefs::kSyncedDefaultSearchProviderGUID, |
57 std::string(), | 55 std::string(), |
58 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 56 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
59 registry->RegisterBooleanPref( | 57 registry->RegisterBooleanPref( |
60 prefs::kDefaultSearchProviderEnabled, | 58 prefs::kDefaultSearchProviderEnabled, |
61 true, | 59 true, |
62 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 60 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
63 registry->RegisterStringPref( | 61 registry->RegisterStringPref( |
64 prefs::kDefaultSearchProviderName, | 62 prefs::kDefaultSearchProviderName, |
65 std::string(), | 63 std::string(), |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 127 } |
130 | 128 |
131 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( | 129 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( |
132 content::BrowserContext* context) const { | 130 content::BrowserContext* context) const { |
133 return chrome::GetBrowserContextRedirectedInIncognito(context); | 131 return chrome::GetBrowserContextRedirectedInIncognito(context); |
134 } | 132 } |
135 | 133 |
136 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { | 134 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { |
137 return true; | 135 return true; |
138 } | 136 } |
OLD | NEW |