forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp_keep_alive_service_factory.cc
47 lines (36 loc) · 1.49 KB
/
app_keep_alive_service_factory.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "apps/app_keep_alive_service_factory.h"
#include "apps/app_keep_alive_service.h"
#include "apps/app_lifetime_monitor_factory.h"
#include "apps/shell_window_registry.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
namespace apps {
// static
AppKeepAliveServiceFactory* AppKeepAliveServiceFactory::GetInstance() {
return Singleton<AppKeepAliveServiceFactory>::get();
}
AppKeepAliveServiceFactory::AppKeepAliveServiceFactory()
: BrowserContextKeyedServiceFactory(
"AppKeepAliveService",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(AppLifetimeMonitorFactory::GetInstance());
}
AppKeepAliveServiceFactory::~AppKeepAliveServiceFactory() {}
BrowserContextKeyedService* AppKeepAliveServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
return new AppKeepAliveService(context);
}
bool AppKeepAliveServiceFactory::ServiceIsCreatedWithBrowserContext() const {
return true;
}
content::BrowserContext* AppKeepAliveServiceFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
return chrome::GetBrowserContextRedirectedInIncognito(context);
}
bool AppKeepAliveServiceFactory::ServiceIsNULLWhileTesting() const {
return true;
}
} // namespace apps