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

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

Issue 10014005: Add a preference for why an extension is disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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_prefs.cc
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index 2c5dc80dedba1f11412b7935529e3c7af619c25d..4feb89f163bd2cbc46a2bbf2cf5f1522c11c3775 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -57,6 +57,9 @@ const char kPrefOrphanAcknowledged[] = "ack_orphan";
// Indicates whether to show an install warning when the user enables.
const char kExtensionDidEscalatePermissions[] = "install_warning_on_enable";
+// Indicates whether the extension was updated while it was disabled.
+const char kPrefDisableReason[] = "disable_reason";
+
// A preference that tracks browser action toolbar configuration. This is a list
// object stored in the Preferences file. The extensions are stored by ID.
const char kExtensionToolbar[] = "extensions.toolbar";
@@ -673,6 +676,25 @@ void ExtensionPrefs::SetDidExtensionEscalatePermissions(
Value::CreateBooleanValue(did_escalate));
}
+ExtensionPrefs::DisableReason ExtensionPrefs::GetDisableReason(
+ const std::string& extension_id) {
+ int value = -1;
+ if (ReadExtensionPrefInteger(extension_id, kPrefDisableReason, &value) &&
+ (value == DISABLE_UNKNOWN ||
+ value == DISABLE_USER_ACTION ||
+ value == DISABLE_PERMISSIONS_INCREASE ||
+ value == DISABLE_RELOAD))
Aaron Boodman 2012/04/09 20:30:48 You could add a DISABLE_LAST to simplify this.
Yoyo Zhou 2012/04/10 01:57:36 I guess so.
+ return static_cast<DisableReason>(value);
+ return DISABLE_UNKNOWN;
+}
+
+void ExtensionPrefs::SetDisableReason(const std::string& extension_id,
+ DisableReason disable_reason) {
+ UpdateExtensionPref(
Aaron Boodman 2012/04/09 20:30:48 Consider removing the key in the case of UNKNOWN t
Yoyo Zhou 2012/04/10 01:57:36 Added a Remove* function.
+ extension_id, kPrefDisableReason,
+ Value::CreateIntegerValue(static_cast<int>(disable_reason)));
+}
+
void ExtensionPrefs::UpdateBlacklist(
const std::set<std::string>& blacklist_set) {
std::vector<std::string> remove_pref_ids;

Powered by Google App Engine
This is Rietveld 408576698