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

Unified Diff: extensions/browser/event_router.cc

Issue 2893693002: Remove NOTIFICATION_EXTENSION_ENABLED. (Closed)
Patch Set: address comments Created 3 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: extensions/browser/event_router.cc
diff --git a/extensions/browser/event_router.cc b/extensions/browser/event_router.cc
index 72121ead18dcbac98e7369b831b7bf6a4d8e5521..8d1507377995e1bd31113e901216380d6699992f 100644
--- a/extensions/browser/event_router.cc
+++ b/extensions/browser/event_router.cc
@@ -17,7 +17,6 @@
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
#include "base/values.h"
-#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/api_activity_monitor.h"
#include "extensions/browser/event_router_factory.h"
@@ -27,7 +26,6 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/lazy_background_task_queue.h"
-#include "extensions/browser/notification_types.h"
#include "extensions/browser/process_manager.h"
#include "extensions/browser/process_map.h"
#include "extensions/common/constants.h"
@@ -50,8 +48,6 @@ namespace extensions {
namespace {
-void DoNothing(ExtensionHost* host) {}
-
// A dictionary of event names to lists of filters that this extension has
// registered from its lazy background page.
const char kFilteredEvents[] = "filtered_events";
@@ -144,10 +140,8 @@ EventRouter::EventRouter(BrowserContext* browser_context,
: browser_context_(browser_context),
extension_prefs_(extension_prefs),
extension_registry_observer_(this),
- listeners_(this) {
- registrar_.Add(this,
- extensions::NOTIFICATION_EXTENSION_ENABLED,
- content::Source<BrowserContext>(browser_context_));
+ listeners_(this),
+ lazy_event_dispatch_util_(browser_context_) {
extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_));
}
@@ -753,28 +747,6 @@ void EventRouter::AddFilterToEvent(const std::string& event_name,
filter_list->Append(filter->CreateDeepCopy());
}
-void EventRouter::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- switch (type) {
- case extensions::NOTIFICATION_EXTENSION_ENABLED: {
- // If the extension has a lazy background page, make sure it gets loaded
- // to register the events the extension is interested in.
- const Extension* extension =
- content::Details<const Extension>(details).ptr();
- if (BackgroundInfo::HasLazyBackgroundPage(extension)) {
- LazyBackgroundTaskQueue* queue =
- LazyBackgroundTaskQueue::Get(browser_context_);
- queue->AddPendingTask(browser_context_, extension->id(),
- base::Bind(&DoNothing));
- }
- break;
- }
- default:
- NOTREACHED();
- }
-}
-
void EventRouter::OnExtensionLoaded(content::BrowserContext* browser_context,
const Extension* extension) {
// Add all registered lazy listeners to our cache.

Powered by Google App Engine
This is Rietveld 408576698