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. 4 5 #include "chrome/browser/extensions/extension_storage_monitor_factory.h" 6 7 #include "chrome/browser/extensions/extension_storage_monitor.h" 8 #include "chrome/browser/extensions/extension_system_factory.h" 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" 10 #include "extensions/browser/extension_prefs_factory.h" 11 #include "extensions/browser/extensions_browser_client.h" 12 13 namespace extensions { 14 15 // static 16 ExtensionStorageMonitor* 17 ExtensionStorageMonitorFactory::GetForBrowserContext( 18 content::BrowserContext* context) { 19 return static_cast<ExtensionStorageMonitor*>( 20 GetInstance()->GetServiceForBrowserContext(context, true)); 21 } 22 23 // static 24 ExtensionStorageMonitorFactory* ExtensionStorageMonitorFactory::GetInstance() { 25 return Singleton<ExtensionStorageMonitorFactory>::get(); 26 } 27 28 ExtensionStorageMonitorFactory::ExtensionStorageMonitorFactory() 29 : BrowserContextKeyedServiceFactory( 30 "ExtensionStorageMonitor", 31 BrowserContextDependencyManager::GetInstance()) { 32 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); 33 DependsOn(ExtensionPrefsFactory::GetInstance()); 34 } 35 36 ExtensionStorageMonitorFactory::~ExtensionStorageMonitorFactory() { 37 } 38 39 KeyedService* ExtensionStorageMonitorFactory::BuildServiceInstanceFor( 40 content::BrowserContext* context) const { 41 return new ExtensionStorageMonitor(context); 42 } 43 44 content::BrowserContext* ExtensionStorageMonitorFactory::GetBrowserContextToUse( 45 content::BrowserContext* context) const { 46 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); 47 } 48 49 bool ExtensionStorageMonitorFactory::ServiceIsCreatedWithBrowserContext() 50 const { 51 return true; 52 } 53 54 bool ExtensionStorageMonitorFactory::ServiceIsNULLWhileTesting() const { 55 return true; 56 } 57 58 } // namespace extensions 59