Show the extension install UI when the user clicks Reenable for a disabled-on-upgrade extension.
Also fix a couple misc bugs with disabled extensions:
- Fix a crash when trying to reenable an uninstalled disabled extension.
- Fix a bug where upgrading a disabled extension would reenable it.
BUG=12140
TEST=no
Review URL: http://codereview.chromium.org/172006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23675 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index f70d7cf..89ef1fc 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -246,8 +246,11 @@
disabled_extensions_.end(),
extension.get());
if (iter != disabled_extensions_.end()) {
- // It's disabled, so don't send the unload notification.
disabled_extensions_.erase(iter);
+ NotificationService::current()->Notify(
+ NotificationType::EXTENSION_UNLOADED_DISABLED,
+ Source<ExtensionsService>(this),
+ Details<Extension>(extension.get()));
return;
}
@@ -313,7 +316,7 @@
extension->IsTheme() ||
extension->location() == Extension::LOAD ||
Extension::IsExternalLocation(extension->location())) {
- Extension* old = GetExtensionById(extension->id());
+ Extension* old = GetExtensionByIdInternal(extension->id(), true, true);
if (old) {
if (extension->version()->CompareTo(*(old->version())) > 0) {
bool higher_permissions =
@@ -374,7 +377,11 @@
}
void ExtensionsService::OnExtensionInstalled(Extension* extension) {
- extension_prefs_->OnExtensionInstalled(extension);
+ // Make sure we don't enable a disabled extension.
+ if (extension_prefs_->GetExtensionState(extension->id()) !=
+ Extension::DISABLED) {
+ extension_prefs_->OnExtensionInstalled(extension);
+ }
// If the extension is a theme, tell the profile (and therefore ThemeProvider)
// to apply it.