summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_prefs.cc
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-22 23:47:33 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-22 23:47:33 +0000
commit27c6f11bfc8bf73d364fac6878f3ca27a92ae2e1 (patch)
treee6a22271fa57e164db621dc1e7454b6c81ff8b19 /chrome/browser/extensions/extension_prefs.cc
parentd3a2cefb1df16176943e1cb14d01a761d7398eea (diff)
downloadchromium_src-27c6f11bfc8bf73d364fac6878f3ca27a92ae2e1.zip
chromium_src-27c6f11bfc8bf73d364fac6878f3ca27a92ae2e1.tar.gz
chromium_src-27c6f11bfc8bf73d364fac6878f3ca27a92ae2e1.tar.bz2
Revert 35184 - This seemed to cause BlacklistedExtensionWillNotInstall
to fail. TBR=finnur@chromium.org TEST=BlacklistedExtensionWillNotInstall Review URL: http://codereview.chromium.org/514001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_prefs.cc')
-rw-r--r--chrome/browser/extensions/extension_prefs.cc44
1 files changed, 10 insertions, 34 deletions
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index e835f32..d3d8b87 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -33,9 +33,6 @@ const wchar_t kPrefVersion[] = L"manifest.version";
// Indicates if an extension is blacklisted:
const wchar_t kPrefBlacklist[] = L"blacklist";
-// Indicates whether to show an install warning when the user enables.
-const wchar_t kShowInstallWarning[] = L"install_warning_on_enable";
-
// A preference that tracks extension shelf configuration. This is a list
// object read from the Preferences file, containing a list of toolstrip URLs.
const wchar_t kExtensionShelf[] = L"extensions.shelf";
@@ -136,20 +133,19 @@ DictionaryValue* ExtensionPrefs::CopyCurrentExtensions() {
return new DictionaryValue;
}
-bool ExtensionPrefs::ReadBooleanFromPref(
- DictionaryValue* ext, const std::wstring& pref_key) {
- if (!ext->HasKey(pref_key)) return false;
- bool bool_value = false;
- if (!ext->GetBoolean(pref_key, &bool_value)) {
- NOTREACHED() << "Failed to fetch " << pref_key << " flag.";
- // In case we could not fetch the flag, we treat it as false.
+bool ExtensionPrefs::IsBlacklistBitSet(DictionaryValue* ext) {
+ if (!ext->HasKey(kPrefBlacklist)) return false;
+ bool is_blacklisted = false;
+ if (!ext->GetBoolean(kPrefBlacklist, &is_blacklisted)) {
+ NOTREACHED() << "Failed to fetch blacklist flag.";
+ // In case we could not fetch the flag, we consider the extension
+ // is NOT blacklisted.
return false;
}
- return bool_value;
+ return is_blacklisted;
}
-bool ExtensionPrefs::ReadExtensionPrefBoolean(
- const std::string& extension_id, const std::wstring& pref_key) {
+bool ExtensionPrefs::IsExtensionBlacklisted(const std::string& extension_id) {
const DictionaryValue* extensions = prefs_->GetDictionary(kExtensionsPref);
DCHECK(extensions);
@@ -163,20 +159,7 @@ bool ExtensionPrefs::ReadExtensionPrefBoolean(
// No such extension yet.
return false;
}
- return ReadBooleanFromPref(ext, pref_key);
-}
-
-bool ExtensionPrefs::IsBlacklistBitSet(DictionaryValue* ext) {
- return ReadBooleanFromPref(ext, kPrefBlacklist);
-}
-
-bool ExtensionPrefs::IsExtensionBlacklisted(const std::string& extension_id) {
- return ReadExtensionPrefBoolean(extension_id, kExtensionsPref);
-}
-
-bool ExtensionPrefs::DidExtensionEscalatePermissions(
- const std::string& extension_id) {
- return ReadExtensionPrefBoolean(extension_id, kShowInstallWarning);
+ return IsBlacklistBitSet(ext);
}
void ExtensionPrefs::UpdateBlacklist(
@@ -368,13 +351,6 @@ void ExtensionPrefs::SetExtensionState(Extension* extension,
prefs_->SavePersistentPrefs();
}
-void ExtensionPrefs::SetShowInstallWarningOnEnable(
- Extension* extension, bool require) {
- UpdateExtensionPref(extension->id(), kShowInstallWarning,
- Value::CreateBooleanValue(require));
- prefs_->SavePersistentPrefs();
-}
-
std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) {
DictionaryValue* extension = GetExtensionPref(extension_id);
if (!extension)