diff options
author | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 22:14:27 +0000 |
---|---|---|
committer | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 22:14:27 +0000 |
commit | a9f39a313b7ecc11d98727d869e15094481f3a65 (patch) | |
tree | 314811ad11e00470fe2bf0cbb00b0fb204d6019f /chrome/browser/extensions/extension_disabled_infobar_delegate.cc | |
parent | 2c6ed18ba01a4f0451517411bf1d98812078f19d (diff) | |
download | chromium_src-a9f39a313b7ecc11d98727d869e15094481f3a65.zip chromium_src-a9f39a313b7ecc11d98727d869e15094481f3a65.tar.gz chromium_src-a9f39a313b7ecc11d98727d869e15094481f3a65.tar.bz2 |
Change extension unload notification to indicate updates.
When an extension in being unloaded, some listeners want to know if it's
because the extension is being updated to a newer version, or disabled. This
changes the details sent to include a reason.
Also this removes the EXTENSION_UNLOADED_DISABLED notification, since only a
small number of places actually cared about the disctinction between
EXTENSION_UNLOADED and EXTENSION_UNLOADED_DISABLED, and puts that information
into the details as well.
BUG=65510
TEST=Should be covered by existing unit & browser tests.
Review URL: http://codereview.chromium.org/5968009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_disabled_infobar_delegate.cc')
-rw-r--r-- | chrome/browser/extensions/extension_disabled_infobar_delegate.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc index 7406117..28e0709 100644 --- a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc +++ b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc @@ -70,7 +70,7 @@ class ExtensionDisabledInfobarDelegate // The user might re-enable the extension in other ways, so watch for that. registrar_.Add(this, NotificationType::EXTENSION_LOADED, Source<Profile>(service->profile())); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED, + registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, Source<Profile>(service->profile())); } virtual ~ExtensionDisabledInfobarDelegate() { @@ -106,17 +106,24 @@ class ExtensionDisabledInfobarDelegate const NotificationDetails& details) { // TODO(mpcomplete): RemoveInfoBar doesn't seem to always result in us // getting deleted. + const Extension* extension = NULL; switch (type.value) { case NotificationType::EXTENSION_LOADED: - case NotificationType::EXTENSION_UNLOADED_DISABLED: { - const Extension* extension = Details<const Extension>(details).ptr(); - if (extension == extension_) - tab_contents_->RemoveInfoBar(this); + extension = Details<const Extension>(details).ptr(); + break; + case NotificationType::EXTENSION_UNLOADED: { + UnloadedExtensionInfo* info = + Details<UnloadedExtensionInfo>(details).ptr(); + if (info->reason == UnloadedExtensionInfo::DISABLE) + extension = info->extension; break; } default: NOTREACHED(); + return; } + if (extension == extension_) + tab_contents_->RemoveInfoBar(this); } private: |