| 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 b0baa0425bf6024d7d1ca7959f192a8d9a8dfac3..f8e65f0e67f3c0e1d1598f68bb4f9a00cbbec61a 100644
|
| --- a/chrome/browser/content_settings/host_content_settings_map.cc
|
| +++ b/chrome/browser/content_settings/host_content_settings_map.cc
|
| @@ -237,34 +237,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(
|
| @@ -301,6 +320,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) {
|
|
|