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

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

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: Address code review feedback. Created 6 years, 6 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.h
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index 8e5b8754349d311b5c827272415ffecdca837ee5..1cf4ae57d382e3827e24ba03f0c10b27e8d279ca 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -155,10 +155,25 @@ class ExtensionService
public content::NotificationObserver,
public extensions::Blacklist::Observer {
public:
+ enum UninstallReason {
+ UNINSTALL_REASON_DEFAULT, // Usually from testing code
Devlin 2014/07/01 17:39:10 Please rename this to UNINSTALL_REASON_FOR_TESTING
rpaquay 2014/07/01 22:56:53 Done.
+ UNINSTALL_REASON_USER_INITIATED, // User performed some UI gesture
+ UNINSTALL_REASON_EXTENSION_DISABLED, // Extension disabled due to error
+ UNINSTALL_REASON_STORAGE_THRESHOLD_EXCEEDED,
+ UNINSTALL_REASON_EXTERNAL_INSTALL_CANCELED,
+ UNINSTALL_REASON_MANAGEMENT_API,
+ UNINSTALL_REASON_SYNC,
+ UNINSTALL_REASON_ORPHANED_SHARED_MODULE,
+ UNINSTALL_REASON_ORPHANED_THEME,
+ UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION,
+ UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION
+ };
+
// Attempts to uninstall an extension from a given ExtensionService. Returns
// true iff the target extension exists.
static bool UninstallExtensionHelper(ExtensionService* extensions_service,
- const std::string& extension_id);
+ const std::string& extension_id,
+ UninstallReason reason);
// Constructor stores pointers to |profile| and |extension_prefs| but
// ownership remains at caller.
@@ -240,14 +255,10 @@ class ExtensionService
void ReloadExtension(const std::string& extension_id);
// Uninstalls the specified extension. Callers should only call this method
- // with extensions that exist. |external_uninstall| is a magical parameter
- // that is only used to send information to ExtensionPrefs, which external
- // callers should never set to true.
- //
- // TODO(aa): Remove |external_uninstall| -- this information should be passed
- // to ExtensionPrefs some other way.
+ // with extensions that exist. |reason| lets the caller specify why the
+ // extension is uninstalled.
virtual bool UninstallExtension(const std::string& extension_id,
- bool external_uninstall,
+ UninstallReason reason,
base::string16* error);
// Enables the extension. If the extension is already enabled, does

Powered by Google App Engine
This is Rietveld 408576698