| Index: chrome/browser/extensions/extension_service.cc
|
| ===================================================================
|
| --- chrome/browser/extensions/extension_service.cc (revision 69996)
|
| +++ chrome/browser/extensions/extension_service.cc (working copy)
|
| @@ -893,7 +893,7 @@
|
|
|
| // Unload before doing more cleanup to ensure that nothing is hanging on to
|
| // any of these resources.
|
| - UnloadExtension(extension_id);
|
| + UnloadExtension(extension_id, UnloadedExtensionInfo::UNINSTALL);
|
|
|
| extension_prefs_->OnExtensionUninstalled(extension_id_copy, location,
|
| external_uninstall);
|
| @@ -971,7 +971,7 @@
|
| ExtensionDOMUI::UnregisterChromeURLOverrides(profile_,
|
| extension->GetChromeURLOverrides());
|
|
|
| - NotifyExtensionUnloaded(extension);
|
| + NotifyExtensionUnloaded(extension, UnloadedExtensionInfo::DISABLED);
|
| UpdateActiveExtensionsInCrashReporter();
|
| }
|
|
|
| @@ -1238,11 +1238,13 @@
|
| Details<const Extension>(extension));
|
| }
|
|
|
| -void ExtensionService::NotifyExtensionUnloaded(const Extension* extension) {
|
| +void ExtensionService::NotifyExtensionUnloaded(
|
| + const Extension* extension, UnloadedExtensionInfo::Reason reason) {
|
| + UnloadedExtensionInfo details(extension, reason);
|
| NotificationService::current()->Notify(
|
| NotificationType::EXTENSION_UNLOADED,
|
| Source<Profile>(profile_),
|
| - Details<const Extension>(extension));
|
| + Details<UnloadedExtensionInfo>(&details));
|
|
|
| if (profile_) {
|
| profile_->UnregisterExtensionWithRequestContexts(extension);
|
| @@ -1372,7 +1374,7 @@
|
| // UnloadExtension will change the extensions_ list. So, we should
|
| // call it outside the iterator loop.
|
| for (unsigned int i = 0; i < to_be_removed.size(); ++i) {
|
| - UnloadExtension(to_be_removed[i]);
|
| + UnloadExtension(to_be_removed[i], UnloadedExtensionInfo::DISABLED);
|
| }
|
| }
|
|
|
| @@ -1399,7 +1401,7 @@
|
| // UnloadExtension will change the extensions_ list. So, we should
|
| // call it outside the iterator loop.
|
| for (unsigned int i = 0; i < to_be_removed.size(); ++i)
|
| - UnloadExtension(to_be_removed[i]);
|
| + UnloadExtension(to_be_removed[i], UnloadedExtensionInfo::DISABLED);
|
| }
|
|
|
| bool ExtensionService::IsIncognitoEnabled(const Extension* extension) {
|
| @@ -1421,7 +1423,7 @@
|
| bool is_enabled = std::find(extensions_.begin(), extensions_.end(),
|
| extension) != extensions_.end();
|
| if (is_enabled) {
|
| - NotifyExtensionUnloaded(extension);
|
| + NotifyExtensionUnloaded(extension, UnloadedExtensionInfo::DISABLED);
|
| NotifyExtensionLoaded(extension);
|
| }
|
| }
|
| @@ -1480,7 +1482,9 @@
|
| new RefCountedList(list_copy))));
|
| }
|
|
|
| -void ExtensionService::UnloadExtension(const std::string& extension_id) {
|
| +void ExtensionService::UnloadExtension(
|
| + const std::string& extension_id,
|
| + UnloadedExtensionInfo::Reason reason) {
|
| // Make sure the extension gets deleted after we return from this function.
|
| scoped_refptr<const Extension> extension(
|
| GetExtensionByIdInternal(extension_id, true, true));
|
| @@ -1507,11 +1511,13 @@
|
| disabled_extensions_.end(),
|
| extension.get());
|
| if (iter != disabled_extensions_.end()) {
|
| + UnloadedExtensionInfo details(extension, reason);
|
| + details.already_disabled = true;
|
| disabled_extensions_.erase(iter);
|
| NotificationService::current()->Notify(
|
| - NotificationType::EXTENSION_UNLOADED_DISABLED,
|
| + NotificationType::EXTENSION_UNLOADED,
|
| Source<Profile>(profile_),
|
| - Details<const Extension>(extension.get()));
|
| + Details<UnloadedExtensionInfo>(&details));
|
| return;
|
| }
|
|
|
| @@ -1520,7 +1526,7 @@
|
| // Remove the extension from our list.
|
| extensions_.erase(iter);
|
|
|
| - NotifyExtensionUnloaded(extension.get());
|
| + NotifyExtensionUnloaded(extension.get(), reason);
|
| UpdateActiveExtensionsInCrashReporter();
|
| }
|
|
|
| @@ -1706,7 +1712,7 @@
|
|
|
| // To upgrade an extension in place, unload the old one and
|
| // then load the new one.
|
| - UnloadExtension(old->id());
|
| + UnloadExtension(old->id(), UnloadedExtensionInfo::UPDATING);
|
| old = NULL;
|
| }
|
|
|
| @@ -1996,8 +2002,10 @@
|
| // We do it in a PostTask so that other handlers of this notification will
|
| // still have access to the Extension and ExtensionHost.
|
| MessageLoop::current()->PostTask(FROM_HERE,
|
| - NewRunnableMethod(this, &ExtensionService::UnloadExtension,
|
| - host->extension()->id()));
|
| + NewRunnableMethod(this,
|
| + &ExtensionService::UnloadExtension,
|
| + host->extension()->id(),
|
| + UnloadedExtensionInfo::DISABLED));
|
| break;
|
| }
|
|
|
|
|