Index: extensions/browser/event_router.cc |
diff --git a/extensions/browser/event_router.cc b/extensions/browser/event_router.cc |
index 72121ead18dcbac98e7369b831b7bf6a4d8e5521..a9d588a1e3de83c7de281d490b15402633212e00 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" |
@@ -145,9 +143,6 @@ EventRouter::EventRouter(BrowserContext* browser_context, |
extension_prefs_(extension_prefs), |
extension_registry_observer_(this), |
listeners_(this) { |
- registrar_.Add(this, |
- extensions::NOTIFICATION_EXTENSION_ENABLED, |
- content::Source<BrowserContext>(browser_context_)); |
extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context_)); |
} |
@@ -753,28 +748,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. |
@@ -786,6 +759,19 @@ void EventRouter::OnExtensionLoaded(content::BrowserContext* browser_context, |
listeners_.LoadFilteredLazyListeners(extension->id(), *filtered_events); |
} |
+void EventRouter::OnExtensionEnabled(content::BrowserContext* browser_context, |
Devlin
2017/05/17 18:37:48
Why do we do this for enabled, but not loaded?
lazyboy
2017/05/17 22:23:25
This seems to be fixing https://bugs.chromium.org/
Devlin
2017/05/18 01:34:45
Ah, thanks for digging that up! The motivation he
lazyboy
2017/05/18 18:10:52
We forcefully send an onInstalled in that case via
Devlin
2017/05/18 18:39:47
Oof, this is quite the rat's nest.
So, RuntimeAPI
|
+ const Extension* extension) { |
+ DCHECK_EQ(browser_context_, browser_context); |
+ // If the extension has a lazy background page, make sure it gets loaded |
+ // to register the events the extension is interested in. |
+ if (BackgroundInfo::HasLazyBackgroundPage(extension)) { |
+ LazyBackgroundTaskQueue* queue = |
+ LazyBackgroundTaskQueue::Get(browser_context_); |
+ queue->AddPendingTask(browser_context_, extension->id(), |
+ base::Bind(&DoNothing)); |
+ } |
+} |
+ |
void EventRouter::OnExtensionUnloaded(content::BrowserContext* browser_context, |
const Extension* extension, |
UnloadedExtensionReason reason) { |