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
{
15 ProcessManager
* ProcessManagerFactory::GetForBrowserContext(
16 BrowserContext
* context
) {
17 return static_cast<ProcessManager
*>(
18 GetInstance()->GetServiceForBrowserContext(context
, true));
22 ProcessManager
* ProcessManagerFactory::GetForBrowserContextIfExists(
23 BrowserContext
* context
) {
24 return static_cast<ProcessManager
*>(
25 GetInstance()->GetServiceForBrowserContext(context
, false));
29 ProcessManagerFactory
* ProcessManagerFactory::GetInstance() {
30 return Singleton
<ProcessManagerFactory
>::get();
33 ProcessManagerFactory::ProcessManagerFactory()
34 : BrowserContextKeyedServiceFactory(
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.
55 } // namespace extensions