1 // Copyright (c) 2013 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/install_tracker_factory.h"
7 #include "base/memory/singleton.h"
8 #include "chrome/browser/extensions/install_tracker.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "extensions/browser/extension_prefs.h"
11 #include "extensions/browser/extension_prefs_factory.h"
12 #include "extensions/browser/extension_system_provider.h"
13 #include "extensions/browser/extensions_browser_client.h"
15 namespace extensions
{
18 InstallTracker
* InstallTrackerFactory::GetForBrowserContext(
19 content::BrowserContext
* context
) {
20 return static_cast<InstallTracker
*>(
21 GetInstance()->GetServiceForBrowserContext(context
, true));
24 InstallTrackerFactory
* InstallTrackerFactory::GetInstance() {
25 return base::Singleton
<InstallTrackerFactory
>::get();
28 InstallTrackerFactory::InstallTrackerFactory()
29 : BrowserContextKeyedServiceFactory(
31 BrowserContextDependencyManager::GetInstance()) {
32 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
33 DependsOn(ExtensionPrefsFactory::GetInstance());
36 InstallTrackerFactory::~InstallTrackerFactory() {
39 KeyedService
* InstallTrackerFactory::BuildServiceInstanceFor(
40 content::BrowserContext
* context
) const {
41 return new InstallTracker(context
, ExtensionPrefs::Get(context
));
44 content::BrowserContext
* InstallTrackerFactory::GetBrowserContextToUse(
45 content::BrowserContext
* context
) const {
46 // The installs themselves are routed to the non-incognito profile and so
47 // should the install progress.
48 return ExtensionsBrowserClient::Get()->GetOriginalContext(context
);
51 } // namespace extensions