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/supervised_user/supervised_user_service_factory.h" | 5 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
6 | 6 |
7 #include "chrome/browser/profiles/incognito_helpers.h" | 7 #include "chrome/browser/profiles/incognito_helpers.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
10 #include "chrome/browser/supervised_user/supervised_user_service.h" | 10 #include "chrome/browser/supervised_user/supervised_user_service.h" |
11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 12 |
| 13 #if defined(ENABLE_EXTENSIONS) |
12 #include "extensions/browser/extension_system_provider.h" | 14 #include "extensions/browser/extension_system_provider.h" |
13 #include "extensions/browser/extensions_browser_client.h" | 15 #include "extensions/browser/extensions_browser_client.h" |
| 16 #endif |
14 | 17 |
15 // static | 18 // static |
16 SupervisedUserService* SupervisedUserServiceFactory::GetForProfile( | 19 SupervisedUserService* SupervisedUserServiceFactory::GetForProfile( |
17 Profile* profile) { | 20 Profile* profile) { |
18 return static_cast<SupervisedUserService*>( | 21 return static_cast<SupervisedUserService*>( |
19 GetInstance()->GetServiceForBrowserContext(profile, true)); | 22 GetInstance()->GetServiceForBrowserContext(profile, true)); |
20 } | 23 } |
21 | 24 |
22 // static | 25 // static |
23 SupervisedUserServiceFactory* SupervisedUserServiceFactory::GetInstance() { | 26 SupervisedUserServiceFactory* SupervisedUserServiceFactory::GetInstance() { |
24 return Singleton<SupervisedUserServiceFactory>::get(); | 27 return Singleton<SupervisedUserServiceFactory>::get(); |
25 } | 28 } |
26 | 29 |
27 // static | 30 // static |
28 KeyedService* SupervisedUserServiceFactory::BuildInstanceFor(Profile* profile) { | 31 KeyedService* SupervisedUserServiceFactory::BuildInstanceFor(Profile* profile) { |
29 return new SupervisedUserService(profile); | 32 return new SupervisedUserService(profile); |
30 } | 33 } |
31 | 34 |
32 SupervisedUserServiceFactory::SupervisedUserServiceFactory() | 35 SupervisedUserServiceFactory::SupervisedUserServiceFactory() |
33 : BrowserContextKeyedServiceFactory( | 36 : BrowserContextKeyedServiceFactory( |
34 "SupervisedUserService", | 37 "SupervisedUserService", |
35 BrowserContextDependencyManager::GetInstance()) { | 38 BrowserContextDependencyManager::GetInstance()) { |
| 39 #if defined(ENABLE_EXTENSIONS) |
36 DependsOn( | 40 DependsOn( |
37 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 41 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
| 42 #endif |
38 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 43 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
39 } | 44 } |
40 | 45 |
41 SupervisedUserServiceFactory::~SupervisedUserServiceFactory() {} | 46 SupervisedUserServiceFactory::~SupervisedUserServiceFactory() {} |
42 | 47 |
43 content::BrowserContext* SupervisedUserServiceFactory::GetBrowserContextToUse( | 48 content::BrowserContext* SupervisedUserServiceFactory::GetBrowserContextToUse( |
44 content::BrowserContext* context) const { | 49 content::BrowserContext* context) const { |
45 return chrome::GetBrowserContextRedirectedInIncognito(context); | 50 return chrome::GetBrowserContextRedirectedInIncognito(context); |
46 } | 51 } |
47 | 52 |
48 KeyedService* SupervisedUserServiceFactory::BuildServiceInstanceFor( | 53 KeyedService* SupervisedUserServiceFactory::BuildServiceInstanceFor( |
49 content::BrowserContext* profile) const { | 54 content::BrowserContext* profile) const { |
50 return BuildInstanceFor(static_cast<Profile*>(profile)); | 55 return BuildInstanceFor(static_cast<Profile*>(profile)); |
51 } | 56 } |
OLD | NEW |