Index: chrome/browser/extensions/extension_service.cc |
=================================================================== |
--- chrome/browser/extensions/extension_service.cc (revision 82593) |
+++ chrome/browser/extensions/extension_service.cc (working copy) |
@@ -68,6 +68,7 @@ |
#include "content/browser/browser_thread.h" |
#include "content/browser/plugin_process_host.h" |
#include "content/browser/plugin_service.h" |
+#include "content/browser/renderer_host/render_process_host.h" |
#include "content/common/json_value_serializer.h" |
#include "content/common/notification_service.h" |
#include "content/common/notification_type.h" |
@@ -387,6 +388,19 @@ |
return !!GetInstalledApp(url); |
} |
+void ExtensionService::SetInstalledAppForRenderer(int renderer_child_id, |
+ const Extension* app) { |
+ installed_app_hosts_[renderer_child_id] = app; |
+} |
+ |
+const Extension* ExtensionService::GetInstalledAppForRenderer( |
+ int renderer_child_id) { |
+ InstalledAppMap::iterator i = installed_app_hosts_.find(renderer_child_id); |
+ if (i == installed_app_hosts_.end()) |
+ return NULL; |
+ return i->second; |
+} |
+ |
// static |
// This function is used to implement the command-line switch |
// --uninstall-extension. The LOG statements within this function are used to |
@@ -448,6 +462,8 @@ |
registrar_.Add(this, NotificationType::EXTENSION_PROCESS_TERMINATED, |
NotificationService::AllSources()); |
+ registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, |
+ NotificationService::AllSources()); |
pref_change_registrar_.Init(profile->GetPrefs()); |
pref_change_registrar_.Add(prefs::kExtensionInstallAllowList, this); |
pref_change_registrar_.Add(prefs::kExtensionInstallDenyList, this); |
@@ -1990,7 +2006,11 @@ |
UnloadedExtensionInfo::DISABLE)); |
break; |
} |
- |
+ case NotificationType::RENDERER_PROCESS_TERMINATED: { |
+ RenderProcessHost* process = Source<RenderProcessHost>(source).ptr(); |
+ installed_app_hosts_.erase(process->id()); |
+ break; |
+ } |
case NotificationType::PREF_CHANGED: { |
std::string* pref_name = Details<std::string>(details).ptr(); |
if (*pref_name == prefs::kExtensionInstallAllowList || |