1 // Copyright 2013 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/apps/ephemeral_app_service_factory.h"
7 #include "chrome/browser/apps/ephemeral_app_service.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
10 #include "extensions/browser/extension_system_provider.h"
11 #include "extensions/browser/extensions_browser_client.h"
13 using extensions::ExtensionsBrowserClient;
17 EphemeralAppServiceFactory::GetForProfile(Profile* profile) {
18 return static_cast<EphemeralAppService*>(
19 GetInstance()->GetServiceForBrowserContext(profile, true));
23 EphemeralAppServiceFactory* EphemeralAppServiceFactory::GetInstance() {
24 return Singleton<EphemeralAppServiceFactory>::get();
27 EphemeralAppServiceFactory::EphemeralAppServiceFactory()
28 : BrowserContextKeyedServiceFactory(
29 "EphemeralAppService",
30 BrowserContextDependencyManager::GetInstance()) {
31 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
34 EphemeralAppServiceFactory::~EphemeralAppServiceFactory() {
37 BrowserContextKeyedService* EphemeralAppServiceFactory::BuildServiceInstanceFor(
38 content::BrowserContext* context) const {
39 return new EphemeralAppService(Profile::FromBrowserContext(context));
42 content::BrowserContext* EphemeralAppServiceFactory::GetBrowserContextToUse(
43 content::BrowserContext* context) const {
44 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
47 bool EphemeralAppServiceFactory::ServiceIsCreatedWithBrowserContext() const {
51 bool EphemeralAppServiceFactory::ServiceIsNULLWhileTesting() const {