Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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. | |
| 4 | |
| 5 #include "chrome/browser/extensions/extension_system_factory.h" | |
| 6 | |
| 7 #include "chrome/browser/extensions/extension_message_service.h" | |
| 8 #include "chrome/browser/extensions/extension_prefs.h" | |
| 9 #include "chrome/browser/extensions/extension_service.h" | |
| 10 #include "chrome/browser/extensions/extension_system.h" | |
| 11 #include "chrome/browser/profiles/profile.h" | |
| 12 #include "chrome/browser/profiles/profile_dependency_manager.h" | |
| 13 | |
| 14 // ExtensionSystemDelegateFactory | |
| 15 | |
| 16 // static | |
| 17 ExtensionSystemImpl::Delegate* ExtensionSystemDelegateFactory::GetForProfile( | |
| 18 Profile* profile) { | |
| 19 return static_cast<ExtensionSystemImpl::Delegate*>( | |
| 20 GetInstance()->GetServiceForProfile(profile, true)); | |
| 21 } | |
| 22 | |
| 23 // static | |
| 24 ExtensionSystemDelegateFactory* ExtensionSystemDelegateFactory::GetInstance() { | |
| 25 return Singleton<ExtensionSystemDelegateFactory>::get(); | |
| 26 } | |
| 27 | |
| 28 ProfileKeyedService* ExtensionSystemDelegateFactory::BuildServiceInstanceFor( | |
| 29 Profile* profile) const { | |
| 30 return new ExtensionSystemImpl::Delegate(profile->GetOriginalProfile()); | |
|
Elliot Glaysher
2012/02/09 20:10:24
Since this is redirected in incognito, I'm pretty
Yoyo Zhou
2012/02/16 21:49:20
Done.
| |
| 31 } | |
| 32 | |
| 33 bool ExtensionSystemDelegateFactory::ServiceRedirectedInIncognito() { | |
| 34 return true; | |
| 35 } | |
| 36 | |
| 37 void ExtensionSystemDelegateFactory::ProfileShutdown(Profile* profile) { | |
| 38 if (GetForProfile(profile)->message_service()) | |
| 39 GetForProfile(profile)->message_service()->DestroyingProfile(); | |
|
Elliot Glaysher
2012/02/09 20:10:24
You probably want this in you ExtensionService::Sh
Yoyo Zhou
2012/02/16 21:49:20
Ah... I didn't read profile_keyed_service.h. This
| |
| 40 ProfileKeyedServiceFactory::ProfileShutdown(profile); | |
| 41 } | |
| 42 | |
| 43 ExtensionSystemDelegateFactory::ExtensionSystemDelegateFactory() | |
| 44 : ProfileKeyedServiceFactory( | |
| 45 "ExtensionSystemDelegate", | |
| 46 ProfileDependencyManager::GetInstance()) { | |
|
Elliot Glaysher
2012/02/09 20:10:24
I assume that either ExtensionSystemDelegateFactor
Yoyo Zhou
2012/02/16 21:49:20
I only found reference to 3 factories, all from Ex
| |
| 47 } | |
| 48 | |
| 49 ExtensionSystemDelegateFactory::~ExtensionSystemDelegateFactory() { | |
| 50 } | |
| 51 | |
| 52 // ExtensionSystemFactory | |
| 53 | |
| 54 // static | |
| 55 ExtensionSystem* ExtensionSystemFactory::GetForProfile( | |
| 56 Profile* profile) { | |
| 57 return static_cast<ExtensionSystem*>( | |
| 58 GetInstance()->GetServiceForProfile(profile, true)); | |
| 59 } | |
| 60 | |
| 61 // static | |
| 62 ExtensionSystemFactory* ExtensionSystemFactory::GetInstance() { | |
| 63 return Singleton<ExtensionSystemFactory>::get(); | |
| 64 } | |
| 65 | |
| 66 ProfileKeyedService* ExtensionSystemFactory::BuildServiceInstanceFor( | |
| 67 Profile* profile) const { | |
| 68 return new ExtensionSystemImpl(profile); | |
| 69 } | |
| 70 | |
| 71 bool ExtensionSystemFactory::ServiceHasOwnInstanceInIncognito() { | |
| 72 return true; | |
| 73 } | |
| 74 | |
| 75 void ExtensionSystemFactory::ProfileShutdown(Profile* profile) { | |
| 76 GetForProfile(profile)->DestroyProcessManager(); | |
|
Elliot Glaysher
2012/02/09 20:10:24
Same as above.
Yoyo Zhou
2012/02/16 21:49:20
Done.
| |
| 77 ProfileKeyedServiceFactory::ProfileShutdown(profile); | |
| 78 } | |
| 79 | |
| 80 ExtensionSystemFactory::ExtensionSystemFactory() | |
| 81 : ProfileKeyedServiceFactory( | |
| 82 "ExtensionSystem", | |
| 83 ProfileDependencyManager::GetInstance()) { | |
| 84 DependsOn(ExtensionSystemDelegateFactory::GetInstance()); | |
| 85 } | |
| 86 | |
| 87 ExtensionSystemFactory::~ExtensionSystemFactory() { | |
| 88 } | |
| OLD | NEW |