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 "apps/app_keep_alive_service_factory.h"
7 #include "apps/app_keep_alive_service.h"
8 #include "apps/app_lifetime_monitor_factory.h"
9 #include "apps/shell_window_registry.h"
10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
16 AppKeepAliveServiceFactory
* AppKeepAliveServiceFactory::GetInstance() {
17 return Singleton
<AppKeepAliveServiceFactory
>::get();
20 AppKeepAliveServiceFactory::AppKeepAliveServiceFactory()
21 : BrowserContextKeyedServiceFactory(
22 "AppKeepAliveService",
23 BrowserContextDependencyManager::GetInstance()) {
24 DependsOn(AppLifetimeMonitorFactory::GetInstance());
27 AppKeepAliveServiceFactory::~AppKeepAliveServiceFactory() {}
29 BrowserContextKeyedService
* AppKeepAliveServiceFactory::BuildServiceInstanceFor(
30 content::BrowserContext
* context
) const {
31 return new AppKeepAliveService(context
);
34 bool AppKeepAliveServiceFactory::ServiceIsCreatedWithBrowserContext() const {
38 content::BrowserContext
* AppKeepAliveServiceFactory::GetBrowserContextToUse(
39 content::BrowserContext
* context
) const {
40 return chrome::GetBrowserContextRedirectedInIncognito(context
);
43 bool AppKeepAliveServiceFactory::ServiceIsNULLWhileTesting() const {