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

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

Issue 98463005: Enable/disable extensions upon changes in blacklist. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added UI, store blacklist state in prefs, +2 unittests. Created 6 years, 11 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 9f416a0ba0e99006e0c5af8c8b1d0c920ae36769..ea3b69ffcdb59e61eaef714f4f125193150774c5 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -67,6 +67,9 @@ const char kPrefVersion[] = "manifest.version";
// Indicates whether an extension is blacklisted.
const char kPrefBlacklist[] = "blacklist";
+// If extension is greylisted.
+const char kPrefGreylist[] = "greylist";
+
// The count of how many times we prompted the user to acknowledge an
// extension.
const char kPrefAcknowledgePromptCount[] = "ack_prompt_count";
@@ -1147,6 +1150,25 @@ void ExtensionPrefs::SetExtensionState(const std::string& extension_id,
content_settings_store_->SetExtensionState(extension_id, enabled);
}
+void ExtensionPrefs::SetExtensionBlacklistState(const std::string& extension_id,
+ BlacklistState state) {
+ SetExtensionBlacklisted(extension_id, state == BLACKLISTED_MALWARE);
+ UpdateExtensionPref(extension_id, kPrefGreylist,
+ new base::FundamentalValue(state));
+}
+
+BlacklistState ExtensionPrefs::GetExtensionBlacklistState(
+ const std::string& extension_id) {
+ if (IsExtensionBlacklisted(extension_id))
+ return BLACKLISTED_MALWARE;
+ const base::DictionaryValue* ext_prefs = GetExtensionPref(extension_id);
+ int int_value;
+ if (ext_prefs && ext_prefs->GetInteger(kPrefGreylist, &int_value))
not at google - send to devlin 2014/01/22 22:24:39 "greylist" seems like a misnomer now [that this is
Oleg Eterevsky 2014/01/23 14:48:54 Done.
+ return static_cast<BlacklistState>(int_value);
+ else
not at google - send to devlin 2014/01/22 22:24:39 no else after return.
Oleg Eterevsky 2014/01/23 14:48:54 Done.
+ return NOT_BLACKLISTED;
not at google - send to devlin 2014/01/22 22:24:39 could you test this logic in extension_prefs_unitt
Oleg Eterevsky 2014/01/23 14:48:54 Done.
+}
+
std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) {
const base::DictionaryValue* extension = GetExtensionPref(extension_id);
if (!extension)

Powered by Google App Engine
This is Rietveld 408576698