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/extension_storage_monitor_factory.h"
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"
13 namespace extensions
{
16 ExtensionStorageMonitor
*
17 ExtensionStorageMonitorFactory::GetForBrowserContext(
18 content::BrowserContext
* context
) {
19 return static_cast<ExtensionStorageMonitor
*>(
20 GetInstance()->GetServiceForBrowserContext(context
, true));
24 ExtensionStorageMonitorFactory
* ExtensionStorageMonitorFactory::GetInstance() {
25 return Singleton
<ExtensionStorageMonitorFactory
>::get();
28 ExtensionStorageMonitorFactory::ExtensionStorageMonitorFactory()
29 : BrowserContextKeyedServiceFactory(
30 "ExtensionStorageMonitor",
31 BrowserContextDependencyManager::GetInstance()) {
32 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
33 DependsOn(ExtensionPrefsFactory::GetInstance());
36 ExtensionStorageMonitorFactory::~ExtensionStorageMonitorFactory() {
39 KeyedService
* ExtensionStorageMonitorFactory::BuildServiceInstanceFor(
40 content::BrowserContext
* context
) const {
41 return new ExtensionStorageMonitor(context
);
44 content::BrowserContext
* ExtensionStorageMonitorFactory::GetBrowserContextToUse(
45 content::BrowserContext
* context
) const {
46 return ExtensionsBrowserClient::Get()->GetOriginalContext(context
);
49 bool ExtensionStorageMonitorFactory::ServiceIsCreatedWithBrowserContext()
54 bool ExtensionStorageMonitorFactory::ServiceIsNULLWhileTesting() const {
58 } // namespace extensions