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

Unified Diff: chrome/browser/extensions/api/declarative/rules_registry_service.cc

Issue 299393002: Use ExtensionRegistryObserver instead of deprecated extension notification from c/b/extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
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 494e45351e8eb4c97812d38311fc171e325a15c0..7e99d994c3ac5a3f324c02dd79c41fa326efcb78 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_service.cc
+++ b/chrome/browser/extensions/api/declarative/rules_registry_service.cc
@@ -48,9 +48,6 @@ RulesRegistryService::RulesRegistryService(content::BrowserContext* context)
profile_(Profile::FromBrowserContext(context)) {
if (profile_) {
extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
- registrar_.Add(this,
- chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED,
- content::Source<Profile>(profile_->GetOriginalProfile()));
registrar_.Add(
this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
content::NotificationService::AllBrowserContextsAndSources());
@@ -216,28 +213,22 @@ void RulesRegistryService::OnExtensionUnloaded(
NotifyRegistriesHelper(&RulesRegistry::OnExtensionUnloaded, extension->id());
}
+void RulesRegistryService::OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension) {
+ NotifyRegistriesHelper(&RulesRegistry::OnExtensionUninstalled,
+ extension->id());
+}
+
void RulesRegistryService::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- switch (type) {
- case chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED: {
- const Extension* extension =
- content::Details<const Extension>(details).ptr();
- NotifyRegistriesHelper(&RulesRegistry::OnExtensionUninstalled,
- extension->id());
- break;
- }
- case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: {
- content::RenderProcessHost* process =
- content::Source<content::RenderProcessHost>(source).ptr();
- RemoveWebViewRulesRegistries(process->GetID());
- break;
- }
- default:
- NOTREACHED();
- break;
- }
+ DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, type);
+
+ content::RenderProcessHost* process =
+ content::Source<content::RenderProcessHost>(source).ptr();
+ RemoveWebViewRulesRegistries(process->GetID());
}
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698