| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "extensions/browser/api/declarative/rules_registry_service.h" | 5 #include "extensions/browser/api/declarative/rules_registry_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 RulesRegistryService::GetFactoryInstance() { | 130 RulesRegistryService::GetFactoryInstance() { |
| 131 return g_factory.Pointer(); | 131 return g_factory.Pointer(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 // static | 134 // static |
| 135 RulesRegistryService* RulesRegistryService::Get( | 135 RulesRegistryService* RulesRegistryService::Get( |
| 136 content::BrowserContext* context) { | 136 content::BrowserContext* context) { |
| 137 return BrowserContextKeyedAPIFactory<RulesRegistryService>::Get(context); | 137 return BrowserContextKeyedAPIFactory<RulesRegistryService>::Get(context); |
| 138 } | 138 } |
| 139 | 139 |
| 140 // static |
| 141 RulesRegistryService* RulesRegistryService::Get( |
| 142 content::BrowserContext* context, |
| 143 bool create) { |
| 144 return BrowserContextKeyedAPIFactory<RulesRegistryService>::Get(context, |
| 145 create); |
| 146 } |
| 147 |
| 140 void RulesRegistryService::RegisterRulesRegistry( | 148 void RulesRegistryService::RegisterRulesRegistry( |
| 141 scoped_refptr<RulesRegistry> rule_registry) { | 149 scoped_refptr<RulesRegistry> rule_registry) { |
| 142 const std::string event_name(rule_registry->event_name()); | 150 const std::string event_name(rule_registry->event_name()); |
| 143 RulesRegistryKey key(event_name, rule_registry->id()); | 151 RulesRegistryKey key(event_name, rule_registry->id()); |
| 144 DCHECK(rule_registries_.find(key) == rule_registries_.end()); | 152 DCHECK(rule_registries_.find(key) == rule_registries_.end()); |
| 145 rule_registries_[key] = rule_registry; | 153 rule_registries_[key] = rule_registry; |
| 146 } | 154 } |
| 147 | 155 |
| 148 scoped_refptr<RulesRegistry> RulesRegistryService::GetRulesRegistry( | 156 scoped_refptr<RulesRegistry> RulesRegistryService::GetRulesRegistry( |
| 149 int rules_registry_id, | 157 int rules_registry_id, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 } | 219 } |
| 212 | 220 |
| 213 void RulesRegistryService::OnExtensionUninstalled( | 221 void RulesRegistryService::OnExtensionUninstalled( |
| 214 content::BrowserContext* browser_context, | 222 content::BrowserContext* browser_context, |
| 215 const Extension* extension, | 223 const Extension* extension, |
| 216 extensions::UninstallReason reason) { | 224 extensions::UninstallReason reason) { |
| 217 NotifyRegistriesHelper(&RulesRegistry::OnExtensionUninstalled, extension); | 225 NotifyRegistriesHelper(&RulesRegistry::OnExtensionUninstalled, extension); |
| 218 } | 226 } |
| 219 | 227 |
| 220 } // namespace extensions | 228 } // namespace extensions |
| OLD | NEW |