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

Unified Diff: extensions/browser/extension_prefs.cc

Issue 98463005: Enable/disable extensions upon changes in blacklist. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « extensions/browser/extension_prefs.h ('k') | extensions/common/extension.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_prefs.cc
diff --git a/extensions/browser/extension_prefs.cc b/extensions/browser/extension_prefs.cc
index 8e56ed73ddce65707ea4252dfb57a61878d6e865..a734638532f4d3a12f309564b4519f98b9016ad1 100644
--- a/extensions/browser/extension_prefs.cc
+++ b/extensions/browser/extension_prefs.cc
@@ -66,6 +66,9 @@ const char kPrefVersion[] = "manifest.version";
// Indicates whether an extension is blacklisted.
const char kPrefBlacklist[] = "blacklist";
+// If extension is greylisted.
+const char kPrefBlacklistState[] = "blacklist_state";
+
// The count of how many times we prompted the user to acknowledge an
// extension.
const char kPrefAcknowledgePromptCount[] = "ack_prompt_count";
@@ -761,12 +764,8 @@ std::set<std::string> ExtensionPrefs::GetBlacklistedExtensions() {
void ExtensionPrefs::SetExtensionBlacklisted(const std::string& extension_id,
bool is_blacklisted) {
bool currently_blacklisted = IsExtensionBlacklisted(extension_id);
- if (is_blacklisted == currently_blacklisted) {
- NOTREACHED() << extension_id << " is " <<
- (currently_blacklisted ? "already" : "not") <<
- " blacklisted";
+ if (is_blacklisted == currently_blacklisted)
return;
- }
// Always make sure the "acknowledged" bit is cleared since the blacklist bit
// is changing.
@@ -1146,6 +1145,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, kPrefBlacklistState,
+ 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(kPrefBlacklistState, &int_value))
+ return static_cast<BlacklistState>(int_value);
+
+ return NOT_BLACKLISTED;
+}
+
std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) {
const base::DictionaryValue* extension = GetExtensionPref(extension_id);
if (!extension)
« no previous file with comments | « extensions/browser/extension_prefs.h ('k') | extensions/common/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698