Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4708)

Unified Diff: chrome/browser/content_settings/content_settings_pref_provider.cc

Issue 7831004: Add a method to the content_settings::ProviderInterface to return the content settings Value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/content_settings/content_settings_pref_provider.cc
diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc
index 1a684868c985b645a2d1167593af7e169ed27202..8df46721e3f55e7d3c8a6fb8ed666c847498a6c5 100644
--- a/chrome/browser/content_settings/content_settings_pref_provider.cc
+++ b/chrome/browser/content_settings/content_settings_pref_provider.cc
@@ -443,6 +443,19 @@ ContentSetting PrefProvider::GetContentSetting(
const GURL& secondary_url,
ContentSettingsType content_type,
const ResourceIdentifier& resource_identifier) const {
+ scoped_ptr<Value> value(GetContentSettingValue(primary_url,
+ secondary_url,
+ content_type,
+ resource_identifier));
+ return value.get() ? ValueToContentSetting(value.get())
+ : CONTENT_SETTING_DEFAULT;
+}
+
+Value* PrefProvider::GetContentSettingValue(
+ const GURL& primary_url,
+ const GURL& secondary_url,
+ ContentSettingsType content_type,
+ const ResourceIdentifier& resource_identifier) const {
// For a |PrefProvider| used in a |HostContentSettingsMap| of a non incognito
// profile, this will always return NULL.
// TODO(markusheintz): I don't like this. I'd like to have an
@@ -455,17 +468,14 @@ ContentSetting PrefProvider::GetContentSetting(
content_type,
resource_identifier);
if (incognito_value)
- return ValueToContentSetting(incognito_value);
+ return incognito_value->DeepCopy();
Value* value = value_map_.GetValue(
primary_url,
secondary_url,
content_type,
resource_identifier);
- if (value)
- return ValueToContentSetting(value);
-
- return CONTENT_SETTING_DEFAULT;
+ return value ? value->DeepCopy() : NULL;
}
void PrefProvider::GetAllContentSettingsRules(

Powered by Google App Engine
This is Rietveld 408576698