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

Unified Diff: extensions/browser/process_manager.cc

Issue 443623002: Revert of Resubmit: Remove deprecated extension notifications from ProcessManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « extensions/browser/process_manager.h ('k') | extensions/browser/process_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/process_manager.cc
diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc
index d379cf76cf4e32f914ea386d17abf81cf1a7f5fe..5ba8c13eadf7a7db18e2efcd88c2adaa300c43c7 100644
--- a/extensions/browser/process_manager.cc
+++ b/extensions/browser/process_manager.cc
@@ -245,12 +245,17 @@
devtools_callback_(base::Bind(&ProcessManager::OnDevToolsStateChanged,
base::Unretained(this))),
last_background_close_sequence_id_(0),
- weak_ptr_factory_(this),
- extension_registry_observer_(this) {
+ weak_ptr_factory_(this) {
// ExtensionRegistry is shared between incognito and regular contexts.
DCHECK_EQ(original_context, extension_registry_->browser_context());
registrar_.Add(this,
extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED,
+ content::Source<BrowserContext>(original_context));
+ registrar_.Add(this,
+ extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
+ content::Source<BrowserContext>(original_context));
+ registrar_.Add(this,
+ extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
content::Source<BrowserContext>(original_context));
registrar_.Add(this,
extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED,
@@ -262,7 +267,6 @@
content::NotificationService::AllSources());
registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
content::NotificationService::AllSources());
- extension_registry_observer_.Add(extension_registry_);
// Note: event_page_idle_time_ must be sufficiently larger (e.g. 2x) than
// kKeepaliveThrottleIntervalInSeconds in ppapi/proxy/plugin_globals.
@@ -660,6 +664,33 @@
break;
}
+ case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
+ BrowserContext* context = content::Source<BrowserContext>(source).ptr();
+ ExtensionSystem* system = ExtensionSystem::Get(context);
+ if (system->ready().is_signaled()) {
+ // The extension system is ready, so create the background host.
+ const Extension* extension =
+ content::Details<const Extension>(details).ptr();
+ CreateBackgroundHostForExtensionLoad(this, extension);
+ }
+ break;
+ }
+
+ case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
+ const Extension* extension =
+ content::Details<UnloadedExtensionInfo>(details)->extension;
+ for (ExtensionHostSet::iterator iter = background_hosts_.begin();
+ iter != background_hosts_.end(); ++iter) {
+ ExtensionHost* host = *iter;
+ if (host->extension_id() == extension->id()) {
+ CloseBackgroundHost(host);
+ break;
+ }
+ }
+ UnregisterExtension(extension->id());
+ break;
+ }
+
case extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED: {
ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
if (background_hosts_.erase(host)) {
@@ -723,30 +754,6 @@
default:
NOTREACHED();
}
-}
-
-void ProcessManager::OnExtensionLoaded(content::BrowserContext* browser_context,
- const Extension* extension) {
- if (ExtensionSystem::Get(browser_context)->ready().is_signaled()) {
- // The extension system is ready, so create the background host.
- CreateBackgroundHostForExtensionLoad(this, extension);
- }
-}
-
-void ProcessManager::OnExtensionUnloaded(
- content::BrowserContext* browser_context,
- const Extension* extension,
- UnloadedExtensionInfo::Reason reason) {
- for (ExtensionHostSet::iterator iter = background_hosts_.begin();
- iter != background_hosts_.end();
- ++iter) {
- ExtensionHost* host = *iter;
- if (host->extension_id() == extension->id()) {
- CloseBackgroundHost(host);
- break;
- }
- }
- UnregisterExtension(extension->id());
}
void ProcessManager::OnDevToolsStateChanged(
« no previous file with comments | « extensions/browser/process_manager.h ('k') | extensions/browser/process_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698