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

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

Issue 275383002: Use ExtensionRegistryObserver instead of deprecated extension notification from c/b/e/api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 42d0ca4f0dee829a94200402941362b3665a0fcb..aba40bbd00a4efeb80094cbbec1230b7e9d61386 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_service.cc
+++ b/chrome/browser/extensions/api/declarative/rules_registry_service.cc
@@ -20,6 +20,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_process_host.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
namespace extensions {
@@ -43,17 +44,13 @@ bool IsWebView(const RulesRegistryService::WebViewKey& webview_key) {
RulesRegistryService::RulesRegistryService(content::BrowserContext* context)
: content_rules_registry_(NULL),
+ extension_registry_observer_(this),
profile_(Profile::FromBrowserContext(context)) {
if (profile_) {
- registrar_.Add(this,
- chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
- content::Source<Profile>(profile_->GetOriginalProfile()));
+ extension_registry_observer_.Add(ExtensionRegistry::Get(profile_));
registrar_.Add(this,
chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
content::Source<Profile>(profile_->GetOriginalProfile()));
- registrar_.Add(this,
- chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
- content::Source<Profile>(profile_->GetOriginalProfile()));
registrar_.Add(
this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
content::NotificationService::AllBrowserContextsAndSources());
@@ -206,18 +203,23 @@ void RulesRegistryService::NotifyRegistriesHelper(
}
}
+void RulesRegistryService::OnExtensionLoaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension) {
+ NotifyRegistriesHelper(&RulesRegistry::OnExtensionLoaded, extension->id());
+}
not at google - send to devlin 2014/05/12 17:53:27 blank line here
limasdf 2014/05/12 23:19:50 Done.
+void RulesRegistryService::OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) {
+ NotifyRegistriesHelper(&RulesRegistry::OnExtensionUnloaded, extension->id());
+}
+
void RulesRegistryService::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
- const Extension* extension =
- content::Details<UnloadedExtensionInfo>(details)->extension;
- NotifyRegistriesHelper(&RulesRegistry::OnExtensionUnloaded,
- extension->id());
- break;
- }
case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
const Extension* extension =
content::Details<const Extension>(details).ptr();
@@ -225,13 +227,6 @@ void RulesRegistryService::Observe(
extension->id());
break;
}
- case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
- const Extension* extension =
- content::Details<const Extension>(details).ptr();
- NotifyRegistriesHelper(&RulesRegistry::OnExtensionLoaded,
- extension->id());
- break;
- }
case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: {
content::RenderProcessHost* process =
content::Source<content::RenderProcessHost>(source).ptr();

Powered by Google App Engine
This is Rietveld 408576698