OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/developer_private/developer_private_api_
factory.h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api_
factory.h" |
6 | 6 |
7 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" | 7 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
8 #include "chrome/browser/extensions/extension_system_factory.h" | 8 #include "chrome/browser/extensions/extension_system_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" |
11 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 11 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 | 14 |
15 // static | 15 // static |
16 DeveloperPrivateAPI* DeveloperPrivateAPIFactory::GetForProfile( | 16 DeveloperPrivateAPI* DeveloperPrivateAPIFactory::GetForProfile( |
17 Profile* profile) { | 17 Profile* profile) { |
18 return static_cast<DeveloperPrivateAPI*>( | 18 return static_cast<DeveloperPrivateAPI*>( |
19 GetInstance()->GetServiceForProfile(profile, true)); | 19 GetInstance()->GetServiceForBrowserContext(profile, true)); |
20 } | 20 } |
21 | 21 |
22 // static | 22 // static |
23 DeveloperPrivateAPIFactory* DeveloperPrivateAPIFactory::GetInstance() { | 23 DeveloperPrivateAPIFactory* DeveloperPrivateAPIFactory::GetInstance() { |
24 return Singleton<DeveloperPrivateAPIFactory>::get(); | 24 return Singleton<DeveloperPrivateAPIFactory>::get(); |
25 } | 25 } |
26 | 26 |
27 DeveloperPrivateAPIFactory::DeveloperPrivateAPIFactory() | 27 DeveloperPrivateAPIFactory::DeveloperPrivateAPIFactory() |
28 : ProfileKeyedServiceFactory("DeveloperPrivateAPI", | 28 : BrowserContextKeyedServiceFactory( |
29 ProfileDependencyManager::GetInstance()) { | 29 "DeveloperPrivateAPI", |
| 30 BrowserContextDependencyManager::GetInstance()) { |
30 DependsOn(ExtensionSystemFactory::GetInstance()); | 31 DependsOn(ExtensionSystemFactory::GetInstance()); |
31 } | 32 } |
32 | 33 |
33 DeveloperPrivateAPIFactory::~DeveloperPrivateAPIFactory() { | 34 DeveloperPrivateAPIFactory::~DeveloperPrivateAPIFactory() { |
34 } | 35 } |
35 | 36 |
36 ProfileKeyedService* DeveloperPrivateAPIFactory::BuildServiceInstanceFor( | 37 BrowserContextKeyedService* DeveloperPrivateAPIFactory::BuildServiceInstanceFor( |
37 content::BrowserContext* profile) const { | 38 content::BrowserContext* profile) const { |
38 return new DeveloperPrivateAPI(static_cast<Profile*>(profile)); | 39 return new DeveloperPrivateAPI(static_cast<Profile*>(profile)); |
39 } | 40 } |
40 | 41 |
41 content::BrowserContext* DeveloperPrivateAPIFactory::GetBrowserContextToUse( | 42 content::BrowserContext* DeveloperPrivateAPIFactory::GetBrowserContextToUse( |
42 content::BrowserContext* context) const { | 43 content::BrowserContext* context) const { |
43 return chrome::GetBrowserContextRedirectedInIncognito(context); | 44 return chrome::GetBrowserContextRedirectedInIncognito(context); |
44 } | 45 } |
45 | 46 |
46 bool DeveloperPrivateAPIFactory::ServiceIsCreatedWithProfile() const { | 47 bool DeveloperPrivateAPIFactory::ServiceIsCreatedWithBrowserContext() const { |
47 return true; | 48 return true; |
48 } | 49 } |
49 | 50 |
50 bool DeveloperPrivateAPIFactory::ServiceIsNULLWhileTesting() const { | 51 bool DeveloperPrivateAPIFactory::ServiceIsNULLWhileTesting() const { |
51 return true; | 52 return true; |
52 } | 53 } |
53 | 54 |
54 } // namespace extensions | 55 } // namespace extensions |
OLD | NEW |