Index: chrome/browser/extensions/tab_helper.cc |
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc |
index 67fd240c883c4dd761db88f9da40670cdf557817..bc92af0b88af50c8d971f4b81f97573ccb8a3a08 100644 |
--- a/chrome/browser/extensions/tab_helper.cc |
+++ b/chrome/browser/extensions/tab_helper.cc |
@@ -84,6 +84,7 @@ TabHelper::TabHelper(content::WebContents* web_contents) |
location_bar_controller_(new LocationBarController(web_contents)), |
extension_action_runner_(new ExtensionActionRunner(web_contents)), |
webstore_inline_installer_factory_(new WebstoreInlineInstallerFactory()), |
+ registry_observer_(this), |
image_loader_ptr_factory_(this), |
weak_ptr_factory_(this) { |
// The ActiveTabPermissionManager requires a session ID; ensure this |
@@ -169,6 +170,13 @@ void TabHelper::SetExtensionApp(const Extension* extension) { |
extension_app_ = extension; |
+ if (extension_app_) { |
+ registry_observer_.Add( |
+ ExtensionRegistry::Get(web_contents()->GetBrowserContext())); |
+ } else { |
+ registry_observer_.RemoveAll(); |
+ } |
+ |
UpdateExtensionAppIcon(extension_app_); |
content::NotificationService::current()->Notify( |
@@ -532,6 +540,15 @@ WebContents* TabHelper::GetAssociatedWebContents() const { |
return web_contents(); |
} |
+void TabHelper::OnExtensionUnloaded( |
+ content::BrowserContext* browser_context, |
+ const Extension* extension, |
+ UnloadedExtensionInfo::Reason reason) { |
+ DCHECK(extension_app_); |
+ if (extension == extension_app_) |
+ SetExtensionApp(nullptr); |
+} |
+ |
void TabHelper::GetApplicationInfo(WebAppAction action) { |
NavigationEntry* entry = |
web_contents()->GetController().GetLastCommittedEntry(); |