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

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

Issue 398083002: Add "UninstallReason" parameter to ExtensionRegistryObserver::OnExtensionUninstalled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index f17b67b981e42548028cce69dd871dd9fdc1b444..f008b53db74c638b6b3b3055503e4dc9857f0aae 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -103,6 +103,7 @@ using extensions::PermissionMessages;
using extensions::PermissionSet;
using extensions::SharedModuleInfo;
using extensions::SharedModuleService;
+using extensions::UninstalledExtensionInfo;
using extensions::UnloadedExtensionInfo;
namespace errors = extensions::manifest_errors;
@@ -168,7 +169,8 @@ void ExtensionService::CheckExternalUninstall(const std::string& id) {
<< "with id: " << id;
return;
}
- UninstallExtension(id, UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION, NULL);
+ UninstallExtension(
+ id, UninstalledExtensionInfo::REASON_ORPHANED_EXTERNAL_EXTENSION, NULL);
}
void ExtensionService::SetFileTaskRunnerForTesting(
@@ -237,7 +239,7 @@ bool ExtensionService::OnExternalExtensionUpdateUrlFound(
bool ExtensionService::UninstallExtensionHelper(
ExtensionService* extensions_service,
const std::string& extension_id,
- UninstallReason reason) {
+ UninstalledExtensionInfo::Reason reason) {
// We can't call UninstallExtension with an invalid extension ID.
if (!extensions_service->GetInstalledExtension(extension_id)) {
LOG(WARNING) << "Attempted uninstallation of non-existent extension with "
@@ -694,7 +696,7 @@ bool ExtensionService::UninstallExtension(
// "transient" because the process of uninstalling may cause the reference
// to become invalid. Instead, use |extenson->id()|.
const std::string& transient_extension_id,
- UninstallReason reason,
+ UninstalledExtensionInfo::Reason reason,
base::string16* error) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -714,9 +716,10 @@ bool ExtensionService::UninstallExtension(
// else, like include an enum IS_INTERNAL_UNINSTALL or IS_USER_UNINSTALL so
// we don't do this.
bool external_uninstall =
- (reason == UNINSTALL_REASON_INTERNAL_MANAGEMENT) ||
- (reason == UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION) ||
- (reason == UNINSTALL_REASON_ORPHANED_SHARED_MODULE);
+ (reason == UninstalledExtensionInfo::REASON_INTERNAL_MANAGEMENT) ||
+ (reason ==
+ UninstalledExtensionInfo::REASON_ORPHANED_EXTERNAL_EXTENSION) ||
Devlin 2014/07/16 20:05:43 nit: please extra-indent this line.
rpaquay 2014/07/16 21:16:45 Done.
+ (reason == UninstalledExtensionInfo::REASON_ORPHANED_SHARED_MODULE);
if (!external_uninstall &&
!system_->management_policy()->UserMayModifySettings(
extension.get(), error)) {
@@ -761,10 +764,11 @@ bool ExtensionService::UninstallExtension(
UntrackTerminatedExtension(extension->id());
// Notify interested parties that we've uninstalled this extension.
+ UninstalledExtensionInfo details(extension, reason);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED,
content::Source<Profile>(profile_),
- content::Details<const Extension>(extension.get()));
+ content::Details<UninstalledExtensionInfo>(&details));
ExtensionRegistry::Get(profile_)->TriggerOnUninstalled(extension.get());
if (extension_sync_service_) {
@@ -1303,10 +1307,12 @@ void ExtensionService::RemoveComponentExtension(
GetExtensionById(extension_id, false));
UnloadExtension(extension_id, UnloadedExtensionInfo::REASON_UNINSTALL);
if (extension.get()) {
+ UninstalledExtensionInfo details(
+ extension, UninstalledExtensionInfo::REASON_INTERNAL_MANAGEMENT);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED,
content::Source<Profile>(profile_),
- content::Details<const Extension>(extension.get()));
+ content::Details<UninstalledExtensionInfo>(&details));
ExtensionRegistry::Get(profile_)->TriggerOnUninstalled(extension.get());
}
}

Powered by Google App Engine
This is Rietveld 408576698