• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #include "apps/app_keep_alive_service_factory.h"
6 
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"
12 
13 namespace apps {
14 
15 // static
GetInstance()16 AppKeepAliveServiceFactory* AppKeepAliveServiceFactory::GetInstance() {
17   return Singleton<AppKeepAliveServiceFactory>::get();
18 }
19 
AppKeepAliveServiceFactory()20 AppKeepAliveServiceFactory::AppKeepAliveServiceFactory()
21     : BrowserContextKeyedServiceFactory(
22           "AppKeepAliveService",
23           BrowserContextDependencyManager::GetInstance()) {
24   DependsOn(AppLifetimeMonitorFactory::GetInstance());
25 }
26 
~AppKeepAliveServiceFactory()27 AppKeepAliveServiceFactory::~AppKeepAliveServiceFactory() {}
28 
BuildServiceInstanceFor(content::BrowserContext * context) const29 BrowserContextKeyedService* AppKeepAliveServiceFactory::BuildServiceInstanceFor(
30     content::BrowserContext* context) const {
31   return new AppKeepAliveService(context);
32 }
33 
ServiceIsCreatedWithBrowserContext() const34 bool AppKeepAliveServiceFactory::ServiceIsCreatedWithBrowserContext() const {
35   return true;
36 }
37 
GetBrowserContextToUse(content::BrowserContext * context) const38 content::BrowserContext* AppKeepAliveServiceFactory::GetBrowserContextToUse(
39     content::BrowserContext* context) const {
40   return chrome::GetBrowserContextRedirectedInIncognito(context);
41 }
42 
ServiceIsNULLWhileTesting() const43 bool AppKeepAliveServiceFactory::ServiceIsNULLWhileTesting() const {
44   return true;
45 }
46 
47 }  // namespace apps
48