OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/instant_service_factory.h" | 5 #include "chrome/browser/search/instant_service_factory.h" |
6 | 6 |
| 7 #include "build/build_config.h" |
7 #include "chrome/browser/history/top_sites_factory.h" | 8 #include "chrome/browser/history/top_sites_factory.h" |
8 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/search/instant_service.h" | 11 #include "chrome/browser/search/instant_service.h" |
11 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" | 12 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" |
12 #include "chrome/browser/search_engines/template_url_service_factory.h" | 13 #include "chrome/browser/search_engines/template_url_service_factory.h" |
13 #include "chrome/browser/themes/theme_service_factory.h" | 14 #include "chrome/browser/themes/theme_service_factory.h" |
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
15 #include "components/search/search.h" | 16 #include "components/search/search.h" |
16 | 17 |
(...skipping 10 matching lines...) Expand all Loading... |
27 InstantServiceFactory* InstantServiceFactory::GetInstance() { | 28 InstantServiceFactory* InstantServiceFactory::GetInstance() { |
28 return base::Singleton<InstantServiceFactory>::get(); | 29 return base::Singleton<InstantServiceFactory>::get(); |
29 } | 30 } |
30 | 31 |
31 InstantServiceFactory::InstantServiceFactory() | 32 InstantServiceFactory::InstantServiceFactory() |
32 : BrowserContextKeyedServiceFactory( | 33 : BrowserContextKeyedServiceFactory( |
33 "InstantService", | 34 "InstantService", |
34 BrowserContextDependencyManager::GetInstance()) { | 35 BrowserContextDependencyManager::GetInstance()) { |
35 DependsOn(suggestions::SuggestionsServiceFactory::GetInstance()); | 36 DependsOn(suggestions::SuggestionsServiceFactory::GetInstance()); |
36 DependsOn(TemplateURLServiceFactory::GetInstance()); | 37 DependsOn(TemplateURLServiceFactory::GetInstance()); |
37 #if defined(ENABLE_THEMES) | 38 #if !defined(OS_ANDROID) |
38 DependsOn(ThemeServiceFactory::GetInstance()); | 39 DependsOn(ThemeServiceFactory::GetInstance()); |
39 #endif | 40 #endif |
40 DependsOn(TopSitesFactory::GetInstance()); | 41 DependsOn(TopSitesFactory::GetInstance()); |
41 } | 42 } |
42 | 43 |
43 InstantServiceFactory::~InstantServiceFactory() { | 44 InstantServiceFactory::~InstantServiceFactory() { |
44 } | 45 } |
45 | 46 |
46 content::BrowserContext* InstantServiceFactory::GetBrowserContextToUse( | 47 content::BrowserContext* InstantServiceFactory::GetBrowserContextToUse( |
47 content::BrowserContext* context) const { | 48 content::BrowserContext* context) const { |
48 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 49 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
49 } | 50 } |
50 | 51 |
51 KeyedService* InstantServiceFactory::BuildServiceInstanceFor( | 52 KeyedService* InstantServiceFactory::BuildServiceInstanceFor( |
52 content::BrowserContext* profile) const { | 53 content::BrowserContext* profile) const { |
53 return search::IsInstantExtendedAPIEnabled() | 54 return search::IsInstantExtendedAPIEnabled() |
54 ? new InstantService(static_cast<Profile*>(profile)) | 55 ? new InstantService(static_cast<Profile*>(profile)) |
55 : NULL; | 56 : NULL; |
56 } | 57 } |
OLD | NEW |