Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: chrome/browser/extensions/install_tracker_factory.cc

Issue 14141006: [components] Switch {RefCounted}ProfileKeyedService to use BrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for review Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/profile.h"
12 #include "chrome/browser/profiles/profile_dependency_manager.h" 13 #include "chrome/browser/profiles/profile_dependency_manager.h"
13 14
14 namespace extensions { 15 namespace extensions {
15 16
16 // static 17 // static
17 InstallTracker* InstallTrackerFactory::GetForProfile(Profile* profile) { 18 InstallTracker* InstallTrackerFactory::GetForProfile(Profile* profile) {
18 return static_cast<InstallTracker*>( 19 return static_cast<InstallTracker*>(
19 GetInstance()->GetServiceForProfile(profile, true)); 20 GetInstance()->GetServiceForProfile(profile, true));
20 } 21 }
21 22
22 InstallTrackerFactory* InstallTrackerFactory::GetInstance() { 23 InstallTrackerFactory* InstallTrackerFactory::GetInstance() {
23 return Singleton<InstallTrackerFactory>::get(); 24 return Singleton<InstallTrackerFactory>::get();
24 } 25 }
25 26
26 InstallTrackerFactory::InstallTrackerFactory() 27 InstallTrackerFactory::InstallTrackerFactory()
27 : ProfileKeyedServiceFactory("InstallTracker", 28 : ProfileKeyedServiceFactory("InstallTracker",
28 ProfileDependencyManager::GetInstance()) { 29 ProfileDependencyManager::GetInstance()) {
29 DependsOn(ExtensionSystemFactory::GetInstance()); 30 DependsOn(ExtensionSystemFactory::GetInstance());
30 } 31 }
31 32
32 InstallTrackerFactory::~InstallTrackerFactory() { 33 InstallTrackerFactory::~InstallTrackerFactory() {
33 } 34 }
34 35
35 ProfileKeyedService* InstallTrackerFactory::BuildServiceInstanceFor( 36 ProfileKeyedService* InstallTrackerFactory::BuildServiceInstanceFor(
36 Profile* profile) const { 37 content::BrowserContext* context) const {
38 Profile* profile = static_cast<Profile*>(context);
37 ExtensionService* service = 39 ExtensionService* service =
38 extensions::ExtensionSystem::Get(profile)->extension_service(); 40 extensions::ExtensionSystem::Get(profile)->extension_service();
39 return new InstallTracker(profile, service->extension_prefs()); 41 return new InstallTracker(profile, service->extension_prefs());
40 } 42 }
41 43
42 bool InstallTrackerFactory::ServiceRedirectedInIncognito() const { 44 bool InstallTrackerFactory::ServiceRedirectedInIncognito() const {
43 // The installs themselves are routed to the non-incognito profile and so 45 // The installs themselves are routed to the non-incognito profile and so
44 // should the install progress. 46 // should the install progress.
45 return true; 47 return true;
46 } 48 }
47 49
48 } // namespace extensions 50 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698