Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / blacklist_factory.cc
bloba485498da6267eee4f510a341236a9d97b2411f1
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 "chrome/browser/extensions/blacklist.h"
6 #include "chrome/browser/extensions/blacklist_factory.h"
7 #include "components/keyed_service/content/browser_context_dependency_manager.h"
8 #include "extensions/browser/extension_prefs.h"
9 #include "extensions/browser/extension_prefs_factory.h"
10 #include "extensions/browser/extensions_browser_client.h"
12 using content::BrowserContext;
14 namespace extensions {
16 // static
17 Blacklist* BlacklistFactory::GetForBrowserContext(BrowserContext* context) {
18 return static_cast<Blacklist*>(
19 GetInstance()->GetServiceForBrowserContext(context, true));
22 // static
23 BlacklistFactory* BlacklistFactory::GetInstance() {
24 return base::Singleton<BlacklistFactory>::get();
27 BlacklistFactory::BlacklistFactory()
28 : BrowserContextKeyedServiceFactory(
29 "Blacklist",
30 BrowserContextDependencyManager::GetInstance()) {
31 DependsOn(extensions::ExtensionPrefsFactory::GetInstance());
34 BlacklistFactory::~BlacklistFactory() {
37 KeyedService* BlacklistFactory::BuildServiceInstanceFor(
38 BrowserContext* context) const {
39 return new Blacklist(ExtensionPrefs::Get(context));
42 BrowserContext* BlacklistFactory::GetBrowserContextToUse(
43 BrowserContext* context) const {
44 // Redirected in incognito.
45 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
48 } // namespace extensions