Chromium Code Reviews| 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 6e02fcf29c8011019d4de163ccf35ce25d1043a3..9e75c48c91e4d992239dbd838cdb1c9aa9766380 100644 |
| --- a/chrome/browser/content_settings/host_content_settings_map.cc |
| +++ b/chrome/browser/content_settings/host_content_settings_map.cc |
| @@ -293,6 +293,34 @@ void HostContentSettingsMap::SetWebsiteSetting( |
| NOTREACHED(); |
| } |
| +void HostContentSettingsMap::SetNarrowestWebsiteSetting( |
| + const ContentSettingsPattern& primary_pattern, |
| + const ContentSettingsPattern& secondary_pattern, |
| + ContentSettingsType content_type, |
| + const std::string& resource_identifier, |
| + ContentSetting setting, |
| + content_settings::SettingInfo existing_info) { |
| + ContentSettingsPattern narrow_primary = primary_pattern; |
| + ContentSettingsPattern narrow_secondary = secondary_pattern; |
| + |
| + DCHECK_EQ(existing_info.source, content_settings::SETTING_SOURCE_USER); |
|
Bernhard Bauer
2014/08/15 17:13:04
If you swap the arguments, the error message on fa
Daniel Nishi
2014/08/15 17:33:46
Done.
|
| + ContentSettingsPattern::Relation r1 = |
| + existing_info.primary_pattern.Compare(primary_pattern); |
| + if (r1 == ContentSettingsPattern::PREDECESSOR) { |
| + narrow_primary = existing_info.primary_pattern; |
| + } else if (r1 == ContentSettingsPattern::IDENTITY) { |
| + ContentSettingsPattern::Relation r2 = |
| + existing_info.secondary_pattern.Compare(secondary_pattern); |
| + DCHECK(r2 != ContentSettingsPattern::DISJOINT_ORDER_POST && |
| + r2 != ContentSettingsPattern::DISJOINT_ORDER_PRE); |
| + if (r2 == ContentSettingsPattern::PREDECESSOR) |
| + narrow_secondary = existing_info.secondary_pattern; |
| + } |
| + |
| + SetContentSetting( |
| + narrow_primary, narrow_secondary, content_type, std::string(), setting); |
| +} |
| + |
| void HostContentSettingsMap::SetContentSetting( |
| const ContentSettingsPattern& primary_pattern, |
| const ContentSettingsPattern& secondary_pattern, |