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

Unified Diff: components/content_settings/core/browser/content_settings_pref.cc

Issue 1318083005: Remove HostContentSettingsMap::ContentTypeHasCompoundValue function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-num-types-enum-3
Patch Set: Created 5 years, 3 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: components/content_settings/core/browser/content_settings_pref.cc
diff --git a/components/content_settings/core/browser/content_settings_pref.cc b/components/content_settings/core/browser/content_settings_pref.cc
index 2443e274884a5d20d0885f4c553dc5730dceb2e9..95d1cd6c87de6e5ba58ee3e6c791d3140f8ffb98 100644
--- a/components/content_settings/core/browser/content_settings_pref.cc
+++ b/components/content_settings/core/browser/content_settings_pref.cc
@@ -25,15 +25,6 @@ const char kSettingPath[] = "setting";
const char kPerResourceIdentifierPrefName[] = "per_resource";
const char kLastUsed[] = "last_used";
-ContentSetting FixObsoleteCookiePromptMode(ContentSettingsType content_type,
- ContentSetting setting) {
- if (content_type == CONTENT_SETTINGS_TYPE_COOKIES &&
- setting == CONTENT_SETTING_ASK) {
- return CONTENT_SETTING_BLOCK;
- }
- return setting;
-}
-
// If the given content type supports resource identifiers in user preferences,
// returns true and sets |pref_key| to the key in the content settings
// dictionary under which per-resource content settings are stored.
@@ -307,28 +298,13 @@ void ContentSettingsPref::ReadContentSettingsFromPref() {
}
}
}
- base::Value* value = NULL;
- if (HostContentSettingsMap::ContentTypeHasCompoundValue(content_type_)) {
- const base::DictionaryValue* setting = NULL;
- // TODO(xians): Handle the non-dictionary types.
- if (settings_dictionary->GetDictionaryWithoutPathExpansion(
- kSettingPath, &setting)) {
- DCHECK(!setting->empty());
- value = setting->DeepCopy();
- }
- } else {
- int setting = CONTENT_SETTING_DEFAULT;
- if (settings_dictionary->GetIntegerWithoutPathExpansion(
- kSettingPath, &setting)) {
- DCHECK_NE(CONTENT_SETTING_DEFAULT, setting);
- setting = FixObsoleteCookiePromptMode(content_type_,
- ContentSetting(setting));
- value = new base::FundamentalValue(setting);
- }
- }
- if (value != NULL) {
- scoped_ptr<base::Value> value_ptr(value);
+ const base::Value* value = nullptr;
+ settings_dictionary->GetWithoutPathExpansion(kSettingPath, &value);
+
+ if (value) {
+ DCHECK(
+ HostContentSettingsMap::IsValueAllowedForType(value, content_type_));
value_map_.SetValue(pattern_pair.first,
pattern_pair.second,
content_type_,

Powered by Google App Engine
This is Rietveld 408576698