OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/extensions/blacklist.h" | 5 #include "chrome/browser/extensions/blacklist.h" |
6 #include "chrome/browser/extensions/blacklist_factory.h" | 6 #include "chrome/browser/extensions/blacklist_factory.h" |
7 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 7 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
8 #include "extensions/browser/extension_prefs.h" | 8 #include "extensions/browser/extension_prefs.h" |
9 #include "extensions/browser/extension_prefs_factory.h" | 9 #include "extensions/browser/extension_prefs_factory.h" |
10 #include "extensions/browser/extensions_browser_client.h" | 10 #include "extensions/browser/extensions_browser_client.h" |
11 | 11 |
12 using content::BrowserContext; | 12 using content::BrowserContext; |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 // static | 16 // static |
17 Blacklist* BlacklistFactory::GetForBrowserContext(BrowserContext* context) { | 17 Blacklist* BlacklistFactory::GetForBrowserContext(BrowserContext* context) { |
18 return static_cast<Blacklist*>( | 18 return static_cast<Blacklist*>( |
19 GetInstance()->GetServiceForBrowserContext(context, true)); | 19 GetInstance()->GetServiceForBrowserContext(context, true)); |
20 } | 20 } |
21 | 21 |
22 // static | 22 // static |
23 BlacklistFactory* BlacklistFactory::GetInstance() { | 23 BlacklistFactory* BlacklistFactory::GetInstance() { |
24 return Singleton<BlacklistFactory>::get(); | 24 return base::Singleton<BlacklistFactory>::get(); |
25 } | 25 } |
26 | 26 |
27 BlacklistFactory::BlacklistFactory() | 27 BlacklistFactory::BlacklistFactory() |
28 : BrowserContextKeyedServiceFactory( | 28 : BrowserContextKeyedServiceFactory( |
29 "Blacklist", | 29 "Blacklist", |
30 BrowserContextDependencyManager::GetInstance()) { | 30 BrowserContextDependencyManager::GetInstance()) { |
31 DependsOn(extensions::ExtensionPrefsFactory::GetInstance()); | 31 DependsOn(extensions::ExtensionPrefsFactory::GetInstance()); |
32 } | 32 } |
33 | 33 |
34 BlacklistFactory::~BlacklistFactory() { | 34 BlacklistFactory::~BlacklistFactory() { |
35 } | 35 } |
36 | 36 |
37 KeyedService* BlacklistFactory::BuildServiceInstanceFor( | 37 KeyedService* BlacklistFactory::BuildServiceInstanceFor( |
38 BrowserContext* context) const { | 38 BrowserContext* context) const { |
39 return new Blacklist(ExtensionPrefs::Get(context)); | 39 return new Blacklist(ExtensionPrefs::Get(context)); |
40 } | 40 } |
41 | 41 |
42 BrowserContext* BlacklistFactory::GetBrowserContextToUse( | 42 BrowserContext* BlacklistFactory::GetBrowserContextToUse( |
43 BrowserContext* context) const { | 43 BrowserContext* context) const { |
44 // Redirected in incognito. | 44 // Redirected in incognito. |
45 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 45 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
46 } | 46 } |
47 | 47 |
48 } // namespace extensions | 48 } // namespace extensions |
49 | 49 |
OLD | NEW |