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

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

Issue 259843004: Remove some NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED from c/b/extensions Part2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comment Created 6 years, 8 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
Index: chrome/browser/extensions/extension_infobar_delegate.cc
diff --git a/chrome/browser/extensions/extension_infobar_delegate.cc b/chrome/browser/extensions/extension_infobar_delegate.cc
index 1411b0aa2e70e74751f0c9a5411d6fd069a5c956..e7695199278f9aec1b1e81678bc7dee64f0fa910 100644
--- a/chrome/browser/extensions/extension_infobar_delegate.cc
+++ b/chrome/browser/extensions/extension_infobar_delegate.cc
@@ -13,6 +13,7 @@
#include "components/infobars/core/infobar.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
ExtensionInfoBarDelegate::~ExtensionInfoBarDelegate() {
@@ -41,15 +42,16 @@ ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(
browser_(browser),
#endif
extension_(extension),
+ extension_registry_observer_(this),
closing_(false) {
extension_view_host_.reset(
extensions::ExtensionViewHostFactory::CreateInfobarHost(url, browser));
extension_view_host_->SetAssociatedWebContents(web_contents);
+ extension_registry_observer_.Add(
+ extensions::ExtensionRegistry::Get(browser->profile()));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
content::Source<Profile>(browser->profile()));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
- content::Source<Profile>(browser->profile()));
height_ = std::max(0, height);
height_ = std::min(2 * infobars::InfoBar::kDefaultBarTargetHeight, height_);
@@ -95,18 +97,20 @@ ExtensionInfoBarDelegate*
return this;
}
+void ExtensionInfoBarDelegate::OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const extensions::Extension* extension,
+ extensions::UnloadedExtensionInfo::Reason reason) {
+ if (extension_ == extension)
+ infobar()->RemoveSelf();
+}
+
void ExtensionInfoBarDelegate::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- if (type == chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE) {
- if (extension_view_host_.get() ==
- content::Details<extensions::ExtensionHost>(details).ptr())
- infobar()->RemoveSelf();
- } else {
- DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED);
- if (extension_ == content::Details<extensions::UnloadedExtensionInfo>(
- details)->extension)
- infobar()->RemoveSelf();
- }
+ DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE);
+ if (extension_view_host_.get() ==
+ content::Details<extensions::ExtensionHost>(details).ptr())
+ infobar()->RemoveSelf();
}
« no previous file with comments | « chrome/browser/extensions/extension_infobar_delegate.h ('k') | chrome/browser/extensions/extension_toolbar_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698