| Index: chrome/browser/content_settings/host_content_settings_map.cc
|
| diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc
|
| index 2c09ad2d3bab9c55f11107c064701faa037cf54c..db119abc12f8dc404449aad34188db3939c7db7a 100644
|
| --- a/chrome/browser/content_settings/host_content_settings_map.cc
|
| +++ b/chrome/browser/content_settings/host_content_settings_map.cc
|
| @@ -210,34 +210,53 @@ void HostContentSettingsMap::SetDefaultContentSetting(
|
| DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE);
|
| DCHECK(IsSettingAllowedForType(setting, content_type));
|
|
|
| - content_settings_providers_[DEFAULT_PROVIDER]->SetContentSetting(
|
| + base::Value* value = Value::CreateIntegerValue(setting);
|
| + content_settings_providers_[DEFAULT_PROVIDER]->SetWebsiteSetting(
|
| ContentSettingsPattern::Wildcard(),
|
| ContentSettingsPattern::Wildcard(),
|
| content_type,
|
| std::string(),
|
| - setting);
|
| + value);
|
| }
|
|
|
| -void HostContentSettingsMap::SetContentSetting(
|
| +void HostContentSettingsMap::SetWebsiteSetting(
|
| const ContentSettingsPattern& primary_pattern,
|
| const ContentSettingsPattern& secondary_pattern,
|
| ContentSettingsType content_type,
|
| const std::string& resource_identifier,
|
| - ContentSetting setting) {
|
| - DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE);
|
| - DCHECK(IsSettingAllowedForType(setting, content_type));
|
| + base::Value* value) {
|
| + DCHECK(IsValueAllowedForType(value, content_type));
|
| DCHECK(content_settings::SupportsResourceIdentifier(content_type) ||
|
| resource_identifier.empty());
|
| for (ProviderIterator provider = content_settings_providers_.begin();
|
| provider != content_settings_providers_.end();
|
| ++provider) {
|
| - provider->second->SetContentSetting(
|
| - primary_pattern,
|
| - secondary_pattern,
|
| - content_type,
|
| - resource_identifier,
|
| - setting);
|
| + if (provider->second->SetWebsiteSetting(primary_pattern,
|
| + secondary_pattern,
|
| + content_type,
|
| + resource_identifier,
|
| + value)) {
|
| + return;
|
| + }
|
| }
|
| + NOTREACHED();
|
| +}
|
| +
|
| +void HostContentSettingsMap::SetContentSetting(
|
| + const ContentSettingsPattern& primary_pattern,
|
| + const ContentSettingsPattern& secondary_pattern,
|
| + ContentSettingsType content_type,
|
| + const std::string& resource_identifier,
|
| + ContentSetting setting) {
|
| + DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE);
|
| + base::Value* value = NULL;
|
| + if (setting != CONTENT_SETTING_DEFAULT)
|
| + value = Value::CreateIntegerValue(setting);
|
| + SetWebsiteSetting(primary_pattern,
|
| + secondary_pattern,
|
| + content_type,
|
| + resource_identifier,
|
| + value);
|
| }
|
|
|
| void HostContentSettingsMap::AddExceptionForURL(
|
| @@ -274,6 +293,12 @@ void HostContentSettingsMap::ClearSettingsForOneType(
|
| }
|
| }
|
|
|
| +bool HostContentSettingsMap::IsValueAllowedForType(
|
| + const base::Value* value, ContentSettingsType type) {
|
| + return IsSettingAllowedForType(
|
| + content_settings::ValueToContentSetting(value), type);
|
| +}
|
| +
|
| // static
|
| bool HostContentSettingsMap::IsSettingAllowedForType(
|
| ContentSetting setting, ContentSettingsType content_type) {
|
|
|