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..bc5ecd91f614ec65576c396aa593ed65d18bb456 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,11 @@ void TabHelper::SetExtensionApp(const Extension* extension) { |
extension_app_ = extension; |
+ if (extension_app_) { |
lazyboy
2016/06/03 01:43:56
lgtm given this is not true:
Is it possible that t
Devlin
2016/06/06 16:50:22
That flow might be able to happen (if e.g. you nav
lazyboy
2016/06/06 18:10:49
Acknowledged.
|
+ registry_observer_.Add( |
+ ExtensionRegistry::Get(web_contents()->GetBrowserContext())); |
+ } |
+ |
UpdateExtensionAppIcon(extension_app_); |
content::NotificationService::current()->Notify( |
@@ -532,6 +538,17 @@ 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); |
+ registry_observer_.RemoveAll(); |
+ } |
+} |
+ |
void TabHelper::GetApplicationInfo(WebAppAction action) { |
NavigationEntry* entry = |
web_contents()->GetController().GetLastCommittedEntry(); |