| Index: components/content_settings/core/browser/content_settings_utils.cc
|
| diff --git a/components/content_settings/core/browser/content_settings_utils.cc b/components/content_settings/core/browser/content_settings_utils.cc
|
| index b989875867893cfee66aa59e6d5033c6af88989d..dbd2823b69423de1f090c5abf50e42690a5ea06d 100644
|
| --- a/components/content_settings/core/browser/content_settings_utils.cc
|
| +++ b/components/content_settings/core/browser/content_settings_utils.cc
|
| @@ -136,7 +136,7 @@ scoped_ptr<base::Value> ContentSettingToValue(ContentSetting setting) {
|
| return make_scoped_ptr(new base::FundamentalValue(setting));
|
| }
|
|
|
| -base::Value* GetContentSettingValueAndPatterns(
|
| +scoped_ptr<base::Value> GetContentSettingValueAndPatterns(
|
| const ProviderInterface* provider,
|
| const GURL& primary_url,
|
| const GURL& secondary_url,
|
| @@ -150,8 +150,9 @@ base::Value* GetContentSettingValueAndPatterns(
|
| // |RuleIterator| gets out of scope before we get a rule iterator for the
|
| // normal mode.
|
| scoped_ptr<RuleIterator> incognito_rule_iterator(
|
| - provider->GetRuleIterator(content_type, resource_identifier, true));
|
| - base::Value* value = GetContentSettingValueAndPatterns(
|
| + provider->GetRuleIterator(content_type, resource_identifier,
|
| + true /* incognito */));
|
| + scoped_ptr<base::Value> value = GetContentSettingValueAndPatterns(
|
| incognito_rule_iterator.get(), primary_url, secondary_url,
|
| primary_pattern, secondary_pattern);
|
| if (value)
|
| @@ -159,13 +160,22 @@ base::Value* GetContentSettingValueAndPatterns(
|
| }
|
| // No settings from the incognito; use the normal mode.
|
| scoped_ptr<RuleIterator> rule_iterator(
|
| - provider->GetRuleIterator(content_type, resource_identifier, false));
|
| - return GetContentSettingValueAndPatterns(
|
| + provider->GetRuleIterator(content_type, resource_identifier,
|
| + false /* incognito */));
|
| + scoped_ptr<base::Value> value = GetContentSettingValueAndPatterns(
|
| rule_iterator.get(), primary_url, secondary_url,
|
| primary_pattern, secondary_pattern);
|
| + if (value && include_incognito &&
|
| + ValueToContentSetting(value.get()) == CONTENT_SETTING_ALLOW) {
|
| + if (WebsiteSettingsRegistry::GetInstance()->Get(content_type)
|
| + ->incognito_behavior()
|
| + == WebsiteSettingsInfo::INHERIT_IN_INCOGNITO_EXCEPT_ALLOW)
|
| + value = ContentSettingToValue(CONTENT_SETTING_ASK);
|
| + }
|
| + return value;
|
| }
|
|
|
| -base::Value* GetContentSettingValueAndPatterns(
|
| +scoped_ptr<base::Value> GetContentSettingValueAndPatterns(
|
| RuleIterator* rule_iterator,
|
| const GURL& primary_url,
|
| const GURL& secondary_url,
|
| @@ -179,10 +189,10 @@ base::Value* GetContentSettingValueAndPatterns(
|
| *primary_pattern = rule.primary_pattern;
|
| if (secondary_pattern)
|
| *secondary_pattern = rule.secondary_pattern;
|
| - return rule.value.get()->DeepCopy();
|
| + return make_scoped_ptr(rule.value.get()->DeepCopy());
|
| }
|
| }
|
| - return NULL;
|
| + return scoped_ptr<base::Value>();
|
| }
|
|
|
| void GetRendererContentSettingRules(const HostContentSettingsMap* map,
|
|
|