Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / chrome / browser / extensions / extension_garbage_collector_factory.cc
blobdebcaf0fb2462e13681859277d779d738d8cd46f
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_garbage_collector_factory.h"
7 #include "base/memory/singleton.h"
8 #include "chrome/browser/extensions/extension_garbage_collector.h"
9 #include "chrome/browser/extensions/extension_system_factory.h"
10 #include "chrome/browser/extensions/install_tracker_factory.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 #include "extensions/browser/extensions_browser_client.h"
14 #if defined(OS_CHROMEOS)
15 #include "chrome/browser/extensions/extension_garbage_collector_chromeos.h"
16 #endif
18 namespace extensions {
20 // static
21 ExtensionGarbageCollector*
22 ExtensionGarbageCollectorFactory::GetForBrowserContext(
23 content::BrowserContext* context) {
24 return static_cast<ExtensionGarbageCollector*>(
25 GetInstance()->GetServiceForBrowserContext(context, true));
28 // static
29 ExtensionGarbageCollectorFactory*
30 ExtensionGarbageCollectorFactory::GetInstance() {
31 return Singleton<ExtensionGarbageCollectorFactory>::get();
34 ExtensionGarbageCollectorFactory::ExtensionGarbageCollectorFactory()
35 : BrowserContextKeyedServiceFactory(
36 "ExtensionGarbageCollector",
37 BrowserContextDependencyManager::GetInstance()) {
38 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
39 DependsOn(InstallTrackerFactory::GetInstance());
42 ExtensionGarbageCollectorFactory::~ExtensionGarbageCollectorFactory() {}
44 // static
45 scoped_ptr<KeyedService> ExtensionGarbageCollectorFactory::BuildInstanceFor(
46 content::BrowserContext* context) {
47 #if defined(OS_CHROMEOS)
48 return make_scoped_ptr(new ExtensionGarbageCollectorChromeOS(context));
49 #else
50 return make_scoped_ptr(new ExtensionGarbageCollector(context));
51 #endif
54 KeyedService* ExtensionGarbageCollectorFactory::BuildServiceInstanceFor(
55 content::BrowserContext* context) const {
56 return BuildInstanceFor(context).release();
59 bool ExtensionGarbageCollectorFactory::ServiceIsCreatedWithBrowserContext()
60 const {
61 return true;
64 bool ExtensionGarbageCollectorFactory::ServiceIsNULLWhileTesting() const {
65 return true;
68 } // namespace extensions