Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / apps / ephemeral_app_service_factory.cc
blobb99cc277c4bc63ed6942e79f19f33d4ef75a22cd
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/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 using extensions::ExtensionSystemFactory;
15 // static
16 EphemeralAppService*
17 EphemeralAppServiceFactory::GetForProfile(Profile* profile) {
18 return static_cast<EphemeralAppService*>(
19 GetInstance()->GetServiceForBrowserContext(profile, true));
22 // static
23 EphemeralAppServiceFactory* EphemeralAppServiceFactory::GetInstance() {
24 return Singleton<EphemeralAppServiceFactory>::get();
27 EphemeralAppServiceFactory::EphemeralAppServiceFactory()
28 : BrowserContextKeyedServiceFactory(
29 "EphemeralAppService",
30 BrowserContextDependencyManager::GetInstance()) {
31 DependsOn(ExtensionSystemFactory::GetInstance());
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 chrome::GetBrowserContextRedirectedInIncognito(context);
47 bool EphemeralAppServiceFactory::ServiceIsCreatedWithBrowserContext() const {
48 return true;
51 bool EphemeralAppServiceFactory::ServiceIsNULLWhileTesting() const {
52 return true;