| Index: components/content_settings/core/browser/host_content_settings_map.cc
|
| diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc
|
| index 3887bb5f009c70b618a978e6969b8fc4723eba76..c6b22b35867f96ac7f8e4b4b4b83785fd69c5458 100644
|
| --- a/components/content_settings/core/browser/host_content_settings_map.cc
|
| +++ b/components/content_settings/core/browser/host_content_settings_map.cc
|
| @@ -157,6 +157,10 @@ ContentSetting HostContentSettingsMap::GetDefaultContentSetting(
|
| continue;
|
| ContentSetting default_setting =
|
| GetDefaultContentSettingFromProvider(content_type, provider->second);
|
| + if (is_off_the_record_) {
|
| + default_setting = CoerceSettingInheritedToIncognito(content_type,
|
| + default_setting);
|
| + }
|
| if (default_setting != CONTENT_SETTING_DEFAULT) {
|
| if (provider_id)
|
| *provider_id = kProviderNamesSourceMap[provider->first].provider_name;
|
| @@ -654,7 +658,7 @@ scoped_ptr<base::Value> HostContentSettingsMap::GetWebsiteSettingInternal(
|
| provider != content_settings_providers_.end();
|
| ++provider) {
|
|
|
| - scoped_ptr<base::Value> value(
|
| + scoped_ptr<base::Value> value =
|
| content_settings::GetContentSettingValueAndPatterns(provider->second,
|
| primary_url,
|
| secondary_url,
|
| @@ -662,7 +666,7 @@ scoped_ptr<base::Value> HostContentSettingsMap::GetWebsiteSettingInternal(
|
| resource_identifier,
|
| is_off_the_record_,
|
| primary_pattern,
|
| - secondary_pattern));
|
| + secondary_pattern);
|
| if (value) {
|
| if (info)
|
| info->source = kProviderNamesSourceMap[provider->first].provider_source;
|
| @@ -677,3 +681,19 @@ scoped_ptr<base::Value> HostContentSettingsMap::GetWebsiteSettingInternal(
|
| }
|
| return scoped_ptr<base::Value>();
|
| }
|
| +
|
| +// static
|
| +ContentSetting HostContentSettingsMap::CoerceSettingInheritedToIncognito(
|
| + ContentSettingsType content_type,
|
| + ContentSetting setting) {
|
| + if (setting != CONTENT_SETTING_ALLOW)
|
| + return setting;
|
| + const content_settings::ContentSettingsInfo* info =
|
| + content_settings::ContentSettingsRegistry::GetInstance()
|
| + ->Get(content_type);
|
| + if (info->incognito_behavior() !=
|
| + content_settings::ContentSettingsInfo::INHERIT_IN_INCOGNITO_EXCEPT_ALLOW)
|
| + return setting;
|
| + DCHECK(info->IsSettingValid(CONTENT_SETTING_ASK));
|
| + return CONTENT_SETTING_ASK;
|
| +}
|
|
|