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