| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api_
factory.h" | |
| 6 | |
| 7 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" | |
| 8 #include "chrome/browser/extensions/extension_system_factory.h" | |
| 9 #include "chrome/browser/profiles/profile.h" | |
| 10 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | |
| 11 #include "extensions/browser/extensions_browser_client.h" | |
| 12 | |
| 13 namespace extensions { | |
| 14 | |
| 15 // static | |
| 16 DeveloperPrivateAPI* DeveloperPrivateAPIFactory::GetForProfile( | |
| 17 Profile* profile) { | |
| 18 return static_cast<DeveloperPrivateAPI*>( | |
| 19 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
| 20 } | |
| 21 | |
| 22 // static | |
| 23 DeveloperPrivateAPIFactory* DeveloperPrivateAPIFactory::GetInstance() { | |
| 24 return Singleton<DeveloperPrivateAPIFactory>::get(); | |
| 25 } | |
| 26 | |
| 27 DeveloperPrivateAPIFactory::DeveloperPrivateAPIFactory() | |
| 28 : BrowserContextKeyedServiceFactory( | |
| 29 "DeveloperPrivateAPI", | |
| 30 BrowserContextDependencyManager::GetInstance()) { | |
| 31 DependsOn(ExtensionSystemFactory::GetInstance()); | |
| 32 } | |
| 33 | |
| 34 DeveloperPrivateAPIFactory::~DeveloperPrivateAPIFactory() { | |
| 35 } | |
| 36 | |
| 37 BrowserContextKeyedService* DeveloperPrivateAPIFactory::BuildServiceInstanceFor( | |
| 38 content::BrowserContext* profile) const { | |
| 39 return new DeveloperPrivateAPI(static_cast<Profile*>(profile)); | |
| 40 } | |
| 41 | |
| 42 content::BrowserContext* DeveloperPrivateAPIFactory::GetBrowserContextToUse( | |
| 43 content::BrowserContext* context) const { | |
| 44 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | |
| 45 } | |
| 46 | |
| 47 bool DeveloperPrivateAPIFactory::ServiceIsCreatedWithBrowserContext() const { | |
| 48 return true; | |
| 49 } | |
| 50 | |
| 51 bool DeveloperPrivateAPIFactory::ServiceIsNULLWhileTesting() const { | |
| 52 return true; | |
| 53 } | |
| 54 | |
| 55 } // namespace extensions | |
| OLD | NEW |