Index: chrome/browser/extensions/extension_process_manager.cc |
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc |
index 806968623b580adb85e0ca85fda6e49460839f9b..b5290f7be01a0ff59aa4e19885483396f0a977f3 100644 |
--- a/chrome/browser/extensions/extension_process_manager.cc |
+++ b/chrome/browser/extensions/extension_process_manager.cc |
@@ -100,6 +100,8 @@ ExtensionProcessManager::ExtensionProcessManager(Profile* profile) |
Source<Profile>(original_profile)); |
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
Source<Profile>(profile)); |
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
+ Source<Profile>(profile)); |
// We can listen to everything for SITE_INSTANCE_DELETED because we check the |
// |site_instance_id| in UnregisterExtensionSiteInstance. |
registrar_.Add(this, content::NOTIFICATION_SITE_INSTANCE_DELETED, |
@@ -336,6 +338,16 @@ void ExtensionProcessManager::Observe(int type, |
break; |
} |
+ case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { |
+ ExtensionHost* host = Details<ExtensionHost>(details).ptr(); |
+ if (host->extension_host_type() == ViewType::EXTENSION_BACKGROUND_PAGE) { |
+ delete host; |
+ // |host| should deregister itself from our structures. |
+ CHECK(background_hosts_.find(host) == background_hosts_.end()); |
+ } |
+ break; |
+ } |
+ |
case content::NOTIFICATION_APP_TERMINATING: { |
// Close background hosts when the last browser is closed so that they |
// have time to shutdown various objects on different threads. Our |