Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / apps / app_keep_alive_service_factory.cc
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/app_window_registry.h"
10 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
11 #include "extensions/browser/extensions_browser_client.h"
12
13 namespace apps {
14
15 // static
16 AppKeepAliveServiceFactory* AppKeepAliveServiceFactory::GetInstance() {
17   return Singleton<AppKeepAliveServiceFactory>::get();
18 }
19
20 AppKeepAliveServiceFactory::AppKeepAliveServiceFactory()
21     : BrowserContextKeyedServiceFactory(
22           "AppKeepAliveService",
23           BrowserContextDependencyManager::GetInstance()) {
24   DependsOn(AppLifetimeMonitorFactory::GetInstance());
25 }
26
27 AppKeepAliveServiceFactory::~AppKeepAliveServiceFactory() {}
28
29 BrowserContextKeyedService* AppKeepAliveServiceFactory::BuildServiceInstanceFor(
30     content::BrowserContext* context) const {
31   return new AppKeepAliveService(context);
32 }
33
34 bool AppKeepAliveServiceFactory::ServiceIsCreatedWithBrowserContext() const {
35   return true;
36 }
37
38 content::BrowserContext* AppKeepAliveServiceFactory::GetBrowserContextToUse(
39     content::BrowserContext* context) const {
40   return extensions::ExtensionsBrowserClient::Get()->
41       GetOriginalContext(context);
42 }
43
44 bool AppKeepAliveServiceFactory::ServiceIsNULLWhileTesting() const {
45   return true;
46 }
47
48 }  // namespace apps