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

Unified Diff: chrome/browser/extensions/tab_helper.cc

Issue 2037873002: [Extensions] Observe unloading extensions in the TabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « chrome/browser/extensions/tab_helper.h ('k') | chrome/browser/extensions/tab_helper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/extensions/tab_helper.h ('k') | chrome/browser/extensions/tab_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698