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/autotest_private/autotest_private_api_factory.h"
7 #include "chrome/browser/extensions/api/autotest_private/autotest_private_api.h"
8 #include "chrome/browser/extensions/extension_system_factory.h"
9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
13 namespace extensions {
16 AutotestPrivateAPI* AutotestPrivateAPIFactory::GetForProfile(Profile* profile) {
17 return static_cast<AutotestPrivateAPI*>(GetInstance()->
18 GetServiceForBrowserContext(profile, true));
22 AutotestPrivateAPIFactory* AutotestPrivateAPIFactory::GetInstance() {
23 return Singleton<AutotestPrivateAPIFactory>::get();
26 AutotestPrivateAPIFactory::AutotestPrivateAPIFactory()
27 : BrowserContextKeyedServiceFactory(
29 BrowserContextDependencyManager::GetInstance()) {
30 DependsOn(ExtensionSystemFactory::GetInstance());
33 AutotestPrivateAPIFactory::~AutotestPrivateAPIFactory() {
36 BrowserContextKeyedService* AutotestPrivateAPIFactory::BuildServiceInstanceFor(
37 content::BrowserContext* profile) const {
38 return new AutotestPrivateAPI();
41 content::BrowserContext* AutotestPrivateAPIFactory::GetBrowserContextToUse(
42 content::BrowserContext* context) const {
43 return chrome::GetBrowserContextRedirectedInIncognito(context);
46 bool AutotestPrivateAPIFactory::ServiceIsCreatedWithBrowserContext() const {
50 bool AutotestPrivateAPIFactory::ServiceIsNULLWhileTesting() const {
54 } // namespace extensions