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 "extensions/browser/extension_pref_value_map_factory.h"
7 #include "components/keyed_service/content/browser_context_dependency_manager.h"
8 #include "extensions/browser/extension_pref_value_map.h"
9 #include "extensions/browser/extensions_browser_client.h"
11 ExtensionPrefValueMapFactory::ExtensionPrefValueMapFactory()
12 : BrowserContextKeyedServiceFactory(
13 "ExtensionPrefValueMap",
14 BrowserContextDependencyManager::GetInstance()) {
17 ExtensionPrefValueMapFactory::~ExtensionPrefValueMapFactory() {
21 ExtensionPrefValueMap
* ExtensionPrefValueMapFactory::GetForBrowserContext(
22 content::BrowserContext
* context
) {
23 return static_cast<ExtensionPrefValueMap
*>(
24 GetInstance()->GetServiceForBrowserContext(context
, true));
28 ExtensionPrefValueMapFactory
* ExtensionPrefValueMapFactory::GetInstance() {
29 return Singleton
<ExtensionPrefValueMapFactory
>::get();
32 KeyedService
* ExtensionPrefValueMapFactory::BuildServiceInstanceFor(
33 content::BrowserContext
* context
) const {
34 return new ExtensionPrefValueMap();
37 content::BrowserContext
* ExtensionPrefValueMapFactory::GetBrowserContextToUse(
38 content::BrowserContext
* context
) const {
39 // Redirected in incognito.
40 return extensions::ExtensionsBrowserClient::Get()->GetOriginalContext(