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

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

Issue 284103002: Replace "external_install" boolean parameter with explicit enumeration in ExtensionUninstall method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 037abdbbdbe63e221bd4e4d1888fafcbb310cb18..df9d82758190593f162257342547f7fd9a1eeab7 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -171,7 +171,7 @@ void ExtensionService::CheckExternalUninstall(const std::string& id) {
<< "with id: " << id;
return;
}
- UninstallExtension(id, true, NULL);
+ UninstallExtension(id, kUninstallReasonOrphanedExternalExtension, NULL);
}
void ExtensionService::SetFileTaskRunnerForTesting(
@@ -234,13 +234,13 @@ bool ExtensionService::OnExternalExtensionUpdateUrlFound(
}
// static
-// This function is used to implement the command-line switch
-// --uninstall-extension, and to uninstall an extension via sync. The LOG
-// statements within this function are used to inform the user if the uninstall
-// cannot be done.
+// This function is used to uninstall an extension via sync. The LOG statements
+// within this function are used to inform the user if the uninstall cannot be
+// done.
bool ExtensionService::UninstallExtensionHelper(
ExtensionService* extensions_service,
- const std::string& extension_id) {
+ const std::string& extension_id,
+ UninstallReason 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 "
@@ -251,7 +251,7 @@ bool ExtensionService::UninstallExtensionHelper(
// The following call to UninstallExtension will not allow an uninstall of a
// policy-controlled extension.
base::string16 error;
- if (!extensions_service->UninstallExtension(extension_id, false, &error)) {
+ if (!extensions_service->UninstallExtension(extension_id, reason, &error)) {
LOG(WARNING) << "Cannot uninstall extension with id " << extension_id
<< ": " << error;
return false;
@@ -662,7 +662,7 @@ void ExtensionService::ReloadExtension(const std::string extension_id) {
}
bool ExtensionService::UninstallExtension(const std::string& extension_id,
- bool external_uninstall,
+ UninstallReason reason,
base::string16* error) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -680,6 +680,9 @@ bool ExtensionService::UninstallExtension(const std::string& extension_id,
// TODO(rdevlin.cronin): This is probably not right. We should do something
// else, like include an enum IS_INTERNAL_UNINSTALL or IS_USER_UNINSTALL so
// we don't do this.
+ bool external_uninstall =
+ (reason == kUninstallReasonOrphanedExternalExtension) ||
+ (reason == kUninstallReasonOrphanedSharedModule);
Devlin 2014/05/14 23:14:20 Shame this is still here... ah well.
if (!external_uninstall &&
!system_->management_policy()->UserMayModifySettings(
extension.get(), error)) {

Powered by Google App Engine
This is Rietveld 408576698