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..06cf8802c2a00068deeba5af5e8bf5e6642f076c 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,20 @@ 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) { |
+ value = ContentSettingToValue( |
+ HostContentSettingsMap::CoerceSettingInheritedToIncognito( |
+ content_type, ValueToContentSetting(value.get()))); |
+ } |
raymes
2015/12/01 03:19:29
What I was suggesting is to move this code into Ho
msramek
2015/12/01 13:41:43
Either that, or we can just simply wrap the callsi
johnme
2015/12/02 15:13:17
I'm not quite sure what you're asking. If you're s
johnme
2015/12/02 15:13:17
Wrapping doesn't work, as Coerce should only be ca
raymes
2015/12/03 01:56:49
I don't quite understand why wrapping doesn't work
johnme
2015/12/03 19:06:40
That doesn't work: suppose the provider has an ALL
raymes
2015/12/03 22:19:42
I'm confused though - AFAICT the code I wrote is f
johnme
2015/12/04 17:14:31
My code does (simplified):
if (include_incognito
|
+ return value; |
} |
-base::Value* GetContentSettingValueAndPatterns( |
+scoped_ptr<base::Value> GetContentSettingValueAndPatterns( |
RuleIterator* rule_iterator, |
const GURL& primary_url, |
const GURL& secondary_url, |
@@ -179,10 +187,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, |