summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 23:25:45 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 23:25:45 +0000
commit6d27a7b2473b8c7b83f55a43eb597f2595007a12 (patch)
tree5445eaba7773f1f48e6d18d734681a514ab37772 /chrome/browser
parent3aa20fe9254d543f491b2ce22471e67a1457df71 (diff)
downloadchromium_src-6d27a7b2473b8c7b83f55a43eb597f2595007a12.zip
chromium_src-6d27a7b2473b8c7b83f55a43eb597f2595007a12.tar.gz
chromium_src-6d27a7b2473b8c7b83f55a43eb597f2595007a12.tar.bz2
Fix a number of issues with extension disable-on-update:
- No longer create 2 infobars. - No longer leak infobars. This fixes a crash. - Update the disabled list before sending the notification, so that the extension management page updates properly. BUG=30407 Review URL: http://codereview.chromium.org/501104 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/extension_disabled_infobar_delegate.cc3
-rw-r--r--chrome/browser/extensions/extensions_service.cc10
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc5
3 files changed, 10 insertions, 8 deletions
diff --git a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc
index a1012c0..feaa264 100644
--- a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc
+++ b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc
@@ -115,6 +115,9 @@ class ExtensionDisabledInfobarDelegate
service_, extension_);
return true;
}
+ virtual void InfoBarClosed() {
+ delete this;
+ }
virtual void Observe(NotificationType type,
const NotificationSource& source,
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 86d86c5..ae251f7 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -617,13 +617,9 @@ void ExtensionsService::OnExtensionLoaded(Extension* extension,
old = NULL;
if (!allow_silent_upgrade) {
- // Extension has changed permissions significantly. Disable it and
- // notify the user.
+ // Extension has changed permissions significantly. Disable it. We
+ // send a notification below.
extension_prefs_->SetExtensionState(extension, Extension::DISABLED);
- NotificationService::current()->Notify(
- NotificationType::EXTENSION_UPDATE_DISABLED,
- Source<Profile>(profile_),
- Details<Extension>(extension));
}
} else {
// We already have the extension of the same or older version.
@@ -665,11 +661,11 @@ void ExtensionsService::OnExtensionLoaded(Extension* extension,
}
break;
case Extension::DISABLED:
+ disabled_extensions_.push_back(scoped_extension.release());
NotificationService::current()->Notify(
NotificationType::EXTENSION_UPDATE_DISABLED,
Source<Profile>(profile_),
Details<Extension>(extension));
- disabled_extensions_.push_back(scoped_extension.release());
break;
default:
NOTREACHED();
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index fd97827..06801fd 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -865,8 +865,11 @@ void TabContents::AddInfoBar(InfoBarDelegate* delegate) {
// Look through the existing InfoBarDelegates we have for a match. If we've
// already got one that matches, then we don't add the new one.
for (int i = 0; i < infobar_delegate_count(); ++i) {
- if (GetInfoBarDelegateAt(i)->EqualsDelegate(delegate))
+ if (GetInfoBarDelegateAt(i)->EqualsDelegate(delegate)) {
+ // Tell the new infobar to close so that it can clean itself up.
+ delegate->InfoBarClosed();
return;
+ }
}
infobar_delegates_.push_back(delegate);