[Android WebViewShell] Add inclusion test for webview exposed stable interfaces.
[chromium-blink-merge.git] / extensions / browser / process_manager_factory.cc
blob370b151db6deae1fa88ca39948e74f8f64a1276d
1 // Copyright 2014 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 "components/keyed_service/content/browser_context_dependency_manager.h"
6 #include "extensions/browser/extension_registry_factory.h"
7 #include "extensions/browser/process_manager.h"
8 #include "extensions/browser/process_manager_factory.h"
10 using content::BrowserContext;
12 namespace extensions {
14 // static
15 ProcessManager* ProcessManagerFactory::GetForBrowserContext(
16 BrowserContext* context) {
17 return static_cast<ProcessManager*>(
18 GetInstance()->GetServiceForBrowserContext(context, true));
21 // static
22 ProcessManager* ProcessManagerFactory::GetForBrowserContextIfExists(
23 BrowserContext* context) {
24 return static_cast<ProcessManager*>(
25 GetInstance()->GetServiceForBrowserContext(context, false));
28 // static
29 ProcessManagerFactory* ProcessManagerFactory::GetInstance() {
30 return Singleton<ProcessManagerFactory>::get();
33 ProcessManagerFactory::ProcessManagerFactory()
34 : BrowserContextKeyedServiceFactory(
35 "ProcessManager",
36 BrowserContextDependencyManager::GetInstance()) {
37 DependsOn(extensions::ExtensionRegistryFactory::GetInstance());
40 ProcessManagerFactory::~ProcessManagerFactory() {
43 KeyedService* ProcessManagerFactory::BuildServiceInstanceFor(
44 BrowserContext* context) const {
45 return ProcessManager::Create(context);
48 BrowserContext* ProcessManagerFactory::GetBrowserContextToUse(
49 BrowserContext* context) const {
50 // ProcessManager::Create handles guest and incognito profiles, returning an
51 // IncognitoProcessManager in incognito mode.
52 return context;
55 } // namespace extensions