| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/suggestions/suggestions_service_factory.h" | 5 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/profiles/incognito_helpers.h" | 8 #include "chrome/browser/profiles/incognito_helpers.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/search/suggestions/blacklist_store.h" |
| 10 #include "chrome/browser/search/suggestions/suggestions_service.h" | 11 #include "chrome/browser/search/suggestions/suggestions_service.h" |
| 11 #include "chrome/browser/search/suggestions/suggestions_store.h" | 12 #include "chrome/browser/search/suggestions/suggestions_store.h" |
| 12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 14 #include "components/pref_registry/pref_registry_syncable.h" | 15 #include "components/pref_registry/pref_registry_syncable.h" |
| 15 | 16 |
| 16 namespace suggestions { | 17 namespace suggestions { |
| 17 | 18 |
| 18 // static | 19 // static |
| 19 SuggestionsService* SuggestionsServiceFactory::GetForProfile(Profile* profile) { | 20 SuggestionsService* SuggestionsServiceFactory::GetForProfile(Profile* profile) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 content::BrowserContext* SuggestionsServiceFactory::GetBrowserContextToUse( | 41 content::BrowserContext* SuggestionsServiceFactory::GetBrowserContextToUse( |
| 41 content::BrowserContext* context) const { | 42 content::BrowserContext* context) const { |
| 42 return chrome::GetBrowserContextRedirectedInIncognito(context); | 43 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 43 } | 44 } |
| 44 | 45 |
| 45 KeyedService* SuggestionsServiceFactory::BuildServiceInstanceFor( | 46 KeyedService* SuggestionsServiceFactory::BuildServiceInstanceFor( |
| 46 content::BrowserContext* profile) const { | 47 content::BrowserContext* profile) const { |
| 47 Profile* the_profile = static_cast<Profile*>(profile); | 48 Profile* the_profile = static_cast<Profile*>(profile); |
| 48 scoped_ptr<SuggestionsStore> suggestions_store( | 49 scoped_ptr<SuggestionsStore> suggestions_store( |
| 49 new SuggestionsStore(the_profile->GetPrefs())); | 50 new SuggestionsStore(the_profile->GetPrefs())); |
| 50 return new SuggestionsService(the_profile, suggestions_store.Pass()); | 51 scoped_ptr<BlacklistStore> blacklist_store( |
| 52 new BlacklistStore(the_profile->GetPrefs())); |
| 53 return new SuggestionsService(the_profile, suggestions_store.Pass(), |
| 54 blacklist_store.Pass()); |
| 51 } | 55 } |
| 52 | 56 |
| 53 void SuggestionsServiceFactory::RegisterProfilePrefs( | 57 void SuggestionsServiceFactory::RegisterProfilePrefs( |
| 54 user_prefs::PrefRegistrySyncable* registry) { | 58 user_prefs::PrefRegistrySyncable* registry) { |
| 55 SuggestionsService::RegisterProfilePrefs(registry); | 59 SuggestionsService::RegisterProfilePrefs(registry); |
| 56 } | 60 } |
| 57 | 61 |
| 58 } // namespace suggestions | 62 } // namespace suggestions |
| OLD | NEW |