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

Unified Diff: chrome/browser/content_settings/content_settings_pref_provider.cc

Issue 7148016: Fix DCHECK error with --enable-resource-content-settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/content_settings/content_settings_pref_provider.cc
diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc
index 072dbb656a6d07ccfa628786e4650ca590b4e5bb..3edac54239ba2c3dce19797848ee115551b244d5 100644
--- a/chrome/browser/content_settings/content_settings_pref_provider.cc
+++ b/chrome/browser/content_settings/content_settings_pref_provider.cc
@@ -752,55 +752,48 @@ void PrefProvider::ReadExceptions(bool overwrite) {
pattern_str, &settings_dictionary);
DCHECK(found);
- for (DictionaryValue::key_iterator i(settings_dictionary->begin_keys());
- i != settings_dictionary->end_keys();
- ++i) {
- const std::string& content_type_str(*i);
- ContentSettingsType content_type = StringToContentSettingsType(
- content_type_str);
- if (content_type == CONTENT_SETTINGS_TYPE_DEFAULT) {
- NOTREACHED();
- LOG(WARNING) << "Skip settings for invalid content settings type '"
- << content_type_str << "'";
- continue;
- }
+ for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
+ ContentSettingsType content_type = static_cast<ContentSettingsType>(i);
if (RequiresResourceIdentifier(content_type)) {
+ const std::string content_type_str = kResourceTypeNames[i];
DictionaryValue* resource_dictionary = NULL;
- bool found = settings_dictionary->GetDictionary(
- content_type_str, &resource_dictionary);
- DCHECK(found);
- for (DictionaryValue::key_iterator j(
- resource_dictionary->begin_keys());
- j != resource_dictionary->end_keys();
- ++j) {
- const std::string& resource_identifier(*j);
- int setting = CONTENT_SETTING_DEFAULT;
- found = resource_dictionary->GetIntegerWithoutPathExpansion(
- resource_identifier, &setting);
- DCHECK(found);
+ if (settings_dictionary->GetDictionary(
+ content_type_str, &resource_dictionary)) {
+ for (DictionaryValue::key_iterator j(
+ resource_dictionary->begin_keys());
+ j != resource_dictionary->end_keys();
+ ++j) {
+ const std::string& resource_identifier(*j);
+ int setting = CONTENT_SETTING_DEFAULT;
+ found = resource_dictionary->GetIntegerWithoutPathExpansion(
+ resource_identifier, &setting);
+ DCHECK_NE(CONTENT_SETTING_DEFAULT, setting);
+ setting = ClickToPlayFixup(content_type,
+ ContentSetting(setting));
+ value_map_.SetValue(pattern,
+ pattern,
+ content_type,
+ resource_identifier,
+ Value::CreateIntegerValue(setting));
+ }
+ }
+ } else if (kTypeNames[i]) {
+ const std::string content_type_str(kTypeNames[i]);
+ int setting = CONTENT_SETTING_DEFAULT;
+ if (settings_dictionary->GetIntegerWithoutPathExpansion(
+ content_type_str, &setting)) {
+ DCHECK_NE(CONTENT_SETTING_DEFAULT, setting);
+ setting = FixObsoleteCookiePromptMode(content_type,
+ ContentSetting(setting));
setting = ClickToPlayFixup(content_type,
ContentSetting(setting));
value_map_.SetValue(pattern,
pattern,
content_type,
- resource_identifier,
+ ResourceIdentifier(""),
Value::CreateIntegerValue(setting));
}
- } else {
- int setting = CONTENT_SETTING_DEFAULT;
- bool found = settings_dictionary->GetIntegerWithoutPathExpansion(
- content_type_str, &setting);
- DCHECK(found);
- setting = FixObsoleteCookiePromptMode(content_type,
- ContentSetting(setting));
- setting = ClickToPlayFixup(content_type,
- ContentSetting(setting));
- value_map_.SetValue(pattern,
- pattern,
- content_type,
- ResourceIdentifier(""),
- Value::CreateIntegerValue(setting));
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698