Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: extensions/browser/extension_registry_factory.cc

Issue 120863003: Convert ExtensionRegistry to a BrowserContextKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 "extensions/browser/extension_registry_factory.h"
6
7 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
8 #include "extensions/browser/extension_registry.h"
9 #include "extensions/browser/extensions_browser_client.h"
10
11 using content::BrowserContext;
12
13 namespace extensions {
14
15 // static
16 ExtensionRegistry* ExtensionRegistryFactory::GetForBrowserContext(
17 BrowserContext* context) {
18 return static_cast<ExtensionRegistry*>(
19 GetInstance()->GetServiceForBrowserContext(context, true));
20 }
21
22 // static
23 ExtensionRegistryFactory* ExtensionRegistryFactory::GetInstance() {
24 return Singleton<ExtensionRegistryFactory>::get();
25 }
26
27 ExtensionRegistryFactory::ExtensionRegistryFactory()
28 : BrowserContextKeyedServiceFactory(
29 "ExtensionRegistry",
30 BrowserContextDependencyManager::GetInstance()) {
31 // No dependencies on other services.
32 }
33
34 ExtensionRegistryFactory::~ExtensionRegistryFactory() {}
35
36 BrowserContextKeyedService* ExtensionRegistryFactory::BuildServiceInstanceFor(
37 content::BrowserContext* profile) const {
38 return new ExtensionRegistry;
39 }
40
41 BrowserContext* ExtensionRegistryFactory::GetBrowserContextToUse(
42 BrowserContext* context) const {
43 // Redirected in incognito.
44 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
45 }
46
47 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698