Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / extension_storage_monitor_factory.cc
blob5aadc183335449efbe56bca2932122e4bf7c8a1d
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 {
15 // static
16 ExtensionStorageMonitor*
17 ExtensionStorageMonitorFactory::GetForBrowserContext(
18 content::BrowserContext* context) {
19 return static_cast<ExtensionStorageMonitor*>(
20 GetInstance()->GetServiceForBrowserContext(context, true));
23 // static
24 ExtensionStorageMonitorFactory* ExtensionStorageMonitorFactory::GetInstance() {
25 return base::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()
50 const {
51 return true;
54 bool ExtensionStorageMonitorFactory::ServiceIsNULLWhileTesting() const {
55 return true;
58 } // namespace extensions