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 429afdd8923cd4594296b4f1b5ca9412135fee0d..a767011bfa41f2cafd40eba697bc542ca4d146a5 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 "base/memory/scoped_ptr.h" |
#include "chrome/browser/extensions/api/declarative/initializing_rules_registry.h" |
@@ -36,7 +37,8 @@ RulesRegistryService::RulesRegistryService(Profile* profile) |
profile_(profile) { |
if (profile) { |
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
- content::Source<Profile>(profile->GetOriginalProfile())); |
+ content::Source<Profile>(profile->GetOriginalProfile())); |
+ RegisterDefaultRulesRegistries(); |
} |
} |
@@ -71,6 +73,20 @@ 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(); |
+} |
+ |
+// static |
+RulesRegistryService* RulesRegistryService::Get(Profile* profile) { |
+ return ProfileKeyedAPIFactory<RulesRegistryService>::GetForProfile(profile); |
+} |
+ |
void RulesRegistryService::RegisterRulesRegistry( |
scoped_refptr<RulesRegistry> rule_registry) { |
const std::string event_name(rule_registry->event_name()); |