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.
5 #include "chrome/browser/extensions/api/developer_private/developer_private_api_factory.h"
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_manager.h"
11 #include "extensions/browser/extensions_browser_client.h"
13 namespace extensions {
16 DeveloperPrivateAPI* DeveloperPrivateAPIFactory::GetForProfile(
18 return static_cast<DeveloperPrivateAPI*>(
19 GetInstance()->GetServiceForBrowserContext(profile, true));
23 DeveloperPrivateAPIFactory* DeveloperPrivateAPIFactory::GetInstance() {
24 return Singleton<DeveloperPrivateAPIFactory>::get();
27 DeveloperPrivateAPIFactory::DeveloperPrivateAPIFactory()
28 : BrowserContextKeyedServiceFactory(
29 "DeveloperPrivateAPI",
30 BrowserContextDependencyManager::GetInstance()) {
31 DependsOn(ExtensionSystemFactory::GetInstance());
34 DeveloperPrivateAPIFactory::~DeveloperPrivateAPIFactory() {
37 BrowserContextKeyedService* DeveloperPrivateAPIFactory::BuildServiceInstanceFor(
38 content::BrowserContext* profile) const {
39 return new DeveloperPrivateAPI(static_cast<Profile*>(profile));
42 content::BrowserContext* DeveloperPrivateAPIFactory::GetBrowserContextToUse(
43 content::BrowserContext* context) const {
44 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
47 bool DeveloperPrivateAPIFactory::ServiceIsCreatedWithBrowserContext() const {
51 bool DeveloperPrivateAPIFactory::ServiceIsNULLWhileTesting() const {
55 } // namespace extensions