| 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 "extensions/browser/warning_service_factory.h" | 5 #include "chrome/browser/extensions/blacklist.h" |
| 6 | 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_registry_factory.h" | 8 #include "extensions/browser/extension_prefs.h" |
| 9 #include "extensions/browser/extension_prefs_factory.h" |
| 9 #include "extensions/browser/extensions_browser_client.h" | 10 #include "extensions/browser/extensions_browser_client.h" |
| 10 #include "extensions/browser/warning_service.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 WarningService* WarningServiceFactory::GetForBrowserContext( | 17 Blacklist* BlacklistFactory::GetForBrowserContext(BrowserContext* context) { |
| 18 BrowserContext* context) { | 18 return static_cast<Blacklist*>( |
| 19 return static_cast<WarningService*>( | |
| 20 GetInstance()->GetServiceForBrowserContext(context, true)); | 19 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 21 } | 20 } |
| 22 | 21 |
| 23 // static | 22 // static |
| 24 WarningServiceFactory* WarningServiceFactory::GetInstance() { | 23 BlacklistFactory* BlacklistFactory::GetInstance() { |
| 25 return Singleton<WarningServiceFactory>::get(); | 24 return Singleton<BlacklistFactory>::get(); |
| 26 } | 25 } |
| 27 | 26 |
| 28 WarningServiceFactory::WarningServiceFactory() | 27 BlacklistFactory::BlacklistFactory() |
| 29 : BrowserContextKeyedServiceFactory( | 28 : BrowserContextKeyedServiceFactory( |
| 30 "WarningService", | 29 "Blacklist", |
| 31 BrowserContextDependencyManager::GetInstance()) { | 30 BrowserContextDependencyManager::GetInstance()) { |
| 32 DependsOn(ExtensionRegistryFactory::GetInstance()); | 31 DependsOn(extensions::ExtensionPrefsFactory::GetInstance()); |
| 33 } | 32 } |
| 34 | 33 |
| 35 WarningServiceFactory::~WarningServiceFactory() { | 34 BlacklistFactory::~BlacklistFactory() { |
| 36 } | 35 } |
| 37 | 36 |
| 38 KeyedService* WarningServiceFactory::BuildServiceInstanceFor( | 37 KeyedService* BlacklistFactory::BuildServiceInstanceFor( |
| 39 BrowserContext* context) const { | 38 BrowserContext* context) const { |
| 40 return new WarningService(context); | 39 return new Blacklist(ExtensionPrefs::Get(context)); |
| 41 } | 40 } |
| 42 | 41 |
| 43 BrowserContext* WarningServiceFactory::GetBrowserContextToUse( | 42 BrowserContext* BlacklistFactory::GetBrowserContextToUse( |
| 44 BrowserContext* context) const { | 43 BrowserContext* context) const { |
| 45 // Redirected in incognito. | 44 // Redirected in incognito. |
| 46 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 45 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
| 47 } | 46 } |
| 48 | 47 |
| 49 } // namespace extensions | 48 } // namespace extensions |
| 49 |
| OLD | NEW |