Finish refactoring of DomCodeToUsLayoutKeyboardCode().
[chromium-blink-merge.git] / extensions / browser / extension_registry_factory.cc
blobdc3c6a02bbdbbfe85bdd010113472abddeabd64b
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.
5 #include "extensions/browser/extension_registry_factory.h"
7 #include "components/keyed_service/content/browser_context_dependency_manager.h"
8 #include "extensions/browser/extension_registry.h"
9 #include "extensions/browser/extensions_browser_client.h"
11 using content::BrowserContext;
13 namespace extensions {
15 // static
16 ExtensionRegistry* ExtensionRegistryFactory::GetForBrowserContext(
17 BrowserContext* context) {
18 return static_cast<ExtensionRegistry*>(
19 GetInstance()->GetServiceForBrowserContext(context, true));
22 // static
23 ExtensionRegistryFactory* ExtensionRegistryFactory::GetInstance() {
24 return Singleton<ExtensionRegistryFactory>::get();
27 ExtensionRegistryFactory::ExtensionRegistryFactory()
28 : BrowserContextKeyedServiceFactory(
29 "ExtensionRegistry",
30 BrowserContextDependencyManager::GetInstance()) {
31 // No dependencies on other services.
34 ExtensionRegistryFactory::~ExtensionRegistryFactory() {}
36 KeyedService* ExtensionRegistryFactory::BuildServiceInstanceFor(
37 content::BrowserContext* context) const {
38 return new ExtensionRegistry(context);
41 BrowserContext* ExtensionRegistryFactory::GetBrowserContextToUse(
42 BrowserContext* context) const {
43 // Redirected in incognito.
44 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
47 } // namespace extensions