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

Side by Side Diff: chrome/browser/extensions/extension_prefs_factory.cc

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "chrome/browser/extensions/extension_pref_value_map.h" 7 #include "chrome/browser/extensions/extension_pref_value_map.h"
8 #include "chrome/browser/extensions/extension_pref_value_map_factory.h" 8 #include "chrome/browser/extensions/extension_pref_value_map_factory.h"
9 #include "chrome/browser/extensions/extension_prefs.h" 9 #include "chrome/browser/extensions/extension_prefs.h"
10 #include "chrome/browser/extensions/extension_prefs_factory.h" 10 #include "chrome/browser/extensions/extension_prefs_factory.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/profiles/incognito_helpers.h" 12 #include "chrome/browser/profiles/incognito_helpers.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 16 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
17 #include "extensions/common/constants.h" 17 #include "extensions/common/constants.h"
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 // static 21 // static
22 ExtensionPrefs* ExtensionPrefsFactory::GetForProfile(Profile* profile) { 22 ExtensionPrefs* ExtensionPrefsFactory::GetForProfile(Profile* profile) {
23 return static_cast<ExtensionPrefs*>( 23 return static_cast<ExtensionPrefs*>(
24 GetInstance()->GetServiceForProfile(profile, true)); 24 GetInstance()->GetServiceForBrowserContext(profile, true));
25 } 25 }
26 26
27 // static 27 // static
28 ExtensionPrefsFactory* ExtensionPrefsFactory::GetInstance() { 28 ExtensionPrefsFactory* ExtensionPrefsFactory::GetInstance() {
29 return Singleton<ExtensionPrefsFactory>::get(); 29 return Singleton<ExtensionPrefsFactory>::get();
30 } 30 }
31 31
32 void ExtensionPrefsFactory::SetInstanceForTesting( 32 void ExtensionPrefsFactory::SetInstanceForTesting(
33 content::BrowserContext* context, ExtensionPrefs* prefs) { 33 content::BrowserContext* context, ExtensionPrefs* prefs) {
34 Associate(context, prefs); 34 Associate(context, prefs);
35 } 35 }
36 36
37 ExtensionPrefsFactory::ExtensionPrefsFactory() 37 ExtensionPrefsFactory::ExtensionPrefsFactory()
38 : ProfileKeyedServiceFactory("ExtensionPrefs", 38 : BrowserContextKeyedServiceFactory(
39 ProfileDependencyManager::GetInstance()) { 39 "ExtensionPrefs",
40 BrowserContextDependencyManager::GetInstance()) {
40 } 41 }
41 42
42 ExtensionPrefsFactory::~ExtensionPrefsFactory() { 43 ExtensionPrefsFactory::~ExtensionPrefsFactory() {
43 } 44 }
44 45
45 ProfileKeyedService* ExtensionPrefsFactory::BuildServiceInstanceFor( 46 BrowserContextKeyedService* ExtensionPrefsFactory::BuildServiceInstanceFor(
46 content::BrowserContext* context) const { 47 content::BrowserContext* context) const {
47 Profile* profile = Profile::FromBrowserContext(context); 48 Profile* profile = Profile::FromBrowserContext(context);
48 bool extensions_disabled = 49 bool extensions_disabled =
49 profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions) || 50 profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions) ||
50 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableExtensions); 51 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableExtensions);
51 return ExtensionPrefs::Create( 52 return ExtensionPrefs::Create(
52 profile->GetPrefs(), 53 profile->GetPrefs(),
53 profile->GetPath().AppendASCII(extensions::kInstallDirectoryName), 54 profile->GetPath().AppendASCII(extensions::kInstallDirectoryName),
54 ExtensionPrefValueMapFactory::GetForProfile(profile), 55 ExtensionPrefValueMapFactory::GetForProfile(profile),
55 extensions_disabled); 56 extensions_disabled);
56 } 57 }
57 58
58 content::BrowserContext* ExtensionPrefsFactory::GetBrowserContextToUse( 59 content::BrowserContext* ExtensionPrefsFactory::GetBrowserContextToUse(
59 content::BrowserContext* context) const { 60 content::BrowserContext* context) const {
60 return chrome::GetBrowserContextRedirectedInIncognito(context); 61 return chrome::GetBrowserContextRedirectedInIncognito(context);
61 } 62 }
62 63
63 } // namespace extensions 64 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698