| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/install_tracker_factory.h" | 5 #include "chrome/browser/extensions/install_tracker_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/extensions/extension_system_factory.h" | 10 #include "chrome/browser/extensions/extension_system_factory.h" |
| 11 #include "chrome/browser/extensions/install_tracker.h" | 11 #include "chrome/browser/extensions/install_tracker.h" |
| 12 #include "chrome/browser/profiles/incognito_helpers.h" | 12 #include "chrome/browser/profiles/incognito_helpers.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 14 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 InstallTracker* InstallTrackerFactory::GetForProfile(Profile* profile) { | 19 InstallTracker* InstallTrackerFactory::GetForProfile(Profile* profile) { |
| 20 return static_cast<InstallTracker*>( | 20 return static_cast<InstallTracker*>( |
| 21 GetInstance()->GetServiceForProfile(profile, true)); | 21 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 InstallTrackerFactory* InstallTrackerFactory::GetInstance() { | 24 InstallTrackerFactory* InstallTrackerFactory::GetInstance() { |
| 25 return Singleton<InstallTrackerFactory>::get(); | 25 return Singleton<InstallTrackerFactory>::get(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 InstallTrackerFactory::InstallTrackerFactory() | 28 InstallTrackerFactory::InstallTrackerFactory() |
| 29 : ProfileKeyedServiceFactory("InstallTracker", | 29 : BrowserContextKeyedServiceFactory( |
| 30 ProfileDependencyManager::GetInstance()) { | 30 "InstallTracker", |
| 31 BrowserContextDependencyManager::GetInstance()) { |
| 31 DependsOn(ExtensionSystemFactory::GetInstance()); | 32 DependsOn(ExtensionSystemFactory::GetInstance()); |
| 32 } | 33 } |
| 33 | 34 |
| 34 InstallTrackerFactory::~InstallTrackerFactory() { | 35 InstallTrackerFactory::~InstallTrackerFactory() { |
| 35 } | 36 } |
| 36 | 37 |
| 37 ProfileKeyedService* InstallTrackerFactory::BuildServiceInstanceFor( | 38 BrowserContextKeyedService* InstallTrackerFactory::BuildServiceInstanceFor( |
| 38 content::BrowserContext* context) const { | 39 content::BrowserContext* context) const { |
| 39 Profile* profile = static_cast<Profile*>(context); | 40 Profile* profile = static_cast<Profile*>(context); |
| 40 ExtensionService* service = | 41 ExtensionService* service = |
| 41 extensions::ExtensionSystem::Get(profile)->extension_service(); | 42 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 42 return new InstallTracker(profile, service->extension_prefs()); | 43 return new InstallTracker(profile, service->extension_prefs()); |
| 43 } | 44 } |
| 44 | 45 |
| 45 content::BrowserContext* InstallTrackerFactory::GetBrowserContextToUse( | 46 content::BrowserContext* InstallTrackerFactory::GetBrowserContextToUse( |
| 46 content::BrowserContext* context) const { | 47 content::BrowserContext* context) const { |
| 47 // The installs themselves are routed to the non-incognito profile and so | 48 // The installs themselves are routed to the non-incognito profile and so |
| 48 // should the install progress. | 49 // should the install progress. |
| 49 return chrome::GetBrowserContextRedirectedInIncognito(context); | 50 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 50 } | 51 } |
| 51 | 52 |
| 52 } // namespace extensions | 53 } // namespace extensions |
| OLD | NEW |