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/ui/app_list/start_page_service_factory.h" | 5 #include "chrome/browser/ui/app_list/start_page_service_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/extensions/install_tracker_factory.h" | 8 #include "chrome/browser/extensions/install_tracker_factory.h" |
9 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 !app_list::switches::IsVoiceSearchEnabled()) { | 24 !app_list::switches::IsVoiceSearchEnabled()) { |
25 return NULL; | 25 return NULL; |
26 } | 26 } |
27 | 27 |
28 return static_cast<StartPageService*>( | 28 return static_cast<StartPageService*>( |
29 GetInstance()->GetServiceForBrowserContext(profile, true)); | 29 GetInstance()->GetServiceForBrowserContext(profile, true)); |
30 } | 30 } |
31 | 31 |
32 // static | 32 // static |
33 StartPageServiceFactory* StartPageServiceFactory::GetInstance() { | 33 StartPageServiceFactory* StartPageServiceFactory::GetInstance() { |
34 return Singleton<StartPageServiceFactory>::get(); | 34 return base::Singleton<StartPageServiceFactory>::get(); |
35 } | 35 } |
36 | 36 |
37 StartPageServiceFactory::StartPageServiceFactory() | 37 StartPageServiceFactory::StartPageServiceFactory() |
38 : BrowserContextKeyedServiceFactory( | 38 : BrowserContextKeyedServiceFactory( |
39 "AppListStartPageService", | 39 "AppListStartPageService", |
40 BrowserContextDependencyManager::GetInstance()) { | 40 BrowserContextDependencyManager::GetInstance()) { |
41 DependsOn( | 41 DependsOn( |
42 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 42 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
43 DependsOn(extensions::InstallTrackerFactory::GetInstance()); | 43 DependsOn(extensions::InstallTrackerFactory::GetInstance()); |
44 DependsOn(TemplateURLServiceFactory::GetInstance()); | 44 DependsOn(TemplateURLServiceFactory::GetInstance()); |
45 } | 45 } |
46 | 46 |
47 StartPageServiceFactory::~StartPageServiceFactory() {} | 47 StartPageServiceFactory::~StartPageServiceFactory() {} |
48 | 48 |
49 KeyedService* StartPageServiceFactory::BuildServiceInstanceFor( | 49 KeyedService* StartPageServiceFactory::BuildServiceInstanceFor( |
50 content::BrowserContext* context) const { | 50 content::BrowserContext* context) const { |
51 Profile* profile = static_cast<Profile*>(context); | 51 Profile* profile = static_cast<Profile*>(context); |
52 return new StartPageService(profile); | 52 return new StartPageService(profile); |
53 } | 53 } |
54 | 54 |
55 content::BrowserContext* StartPageServiceFactory::GetBrowserContextToUse( | 55 content::BrowserContext* StartPageServiceFactory::GetBrowserContextToUse( |
56 content::BrowserContext* context) const { | 56 content::BrowserContext* context) const { |
57 // The start page service needs an instance in ChromeOS guest mode. | 57 // The start page service needs an instance in ChromeOS guest mode. |
58 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 58 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
59 } | 59 } |
60 | 60 |
61 } // namespace app_list | 61 } // namespace app_list |
OLD | NEW |