Chromium Code Reviews| Index: chrome/browser/extensions/api/declarative/rules_registry_service.cc |
| diff --git a/chrome/browser/extensions/api/declarative/rules_registry_service.cc b/chrome/browser/extensions/api/declarative/rules_registry_service.cc |
| index 011a91a72cb96f33acacaba41a46b59fb2793eca..04c93105d427e341c70d52c61b71a6cb089116a0 100644 |
| --- a/chrome/browser/extensions/api/declarative/rules_registry_service.cc |
| +++ b/chrome/browser/extensions/api/declarative/rules_registry_service.cc |
| @@ -5,6 +5,7 @@ |
| #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" |
| #include "base/bind.h" |
| +#include "base/lazy_instance.h" |
| #include "base/logging.h" |
| #include "chrome/browser/extensions/api/declarative/initializing_rules_registry.h" |
| #include "chrome/browser/extensions/api/declarative/rules_registry_storage_delegate.h" |
| @@ -47,6 +48,7 @@ RulesRegistryService::RulesRegistryService(Profile* profile) |
| if (profile) { |
| registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| content::Source<Profile>(profile->GetOriginalProfile())); |
| + RegisterDefaultRulesRegistries(); |
| } |
| } |
| @@ -99,6 +101,19 @@ void RulesRegistryService::Shutdown() { |
| profile_, scoped_refptr<WebRequestRulesRegistry>(NULL))); |
| } |
| +static base::LazyInstance<ProfileKeyedAPIFactory<RulesRegistryService> > |
| +g_factory = LAZY_INSTANCE_INITIALIZER; |
| + |
| +// static |
| +ProfileKeyedAPIFactory<RulesRegistryService>* |
| +RulesRegistryService::GetFactoryInstance() { |
| + return &g_factory.Get(); |
| +} |
| + |
| +RulesRegistryService* RulesRegistryService::Get(Profile* profile) { |
|
Devlin
2013/04/26 01:46:00
nit: // static
Patrick Riordan
2013/04/26 01:53:26
Done.
|
| + return ProfileKeyedAPIFactory<RulesRegistryService>::GetForProfile(profile); |
| +} |
| + |
| void RulesRegistryService::RegisterRulesRegistry( |
| const std::string& event_name, |
| scoped_refptr<RulesRegistry> rule_registry) { |