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

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

Issue 8356010: Merge 106270 - Check for default content settings when requiring user authorization for plug-ins. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/912/src
Patch Set: fix Created 9 years, 2 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/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 93eea27834da5ba77565970a962f68085442d607..caca4a835b6312a0561007a4843a101e63244c8e 100644
--- a/chrome/browser/content_settings/host_content_settings_map.cc
+++ b/chrome/browser/content_settings/host_content_settings_map.cc
@@ -250,61 +250,41 @@ ContentSetting HostContentSettingsMap::GetContentSetting(
const GURL& secondary_url,
ContentSettingsType content_type,
const std::string& resource_identifier) const {
- DCHECK_NE(CONTENT_SETTINGS_TYPE_COOKIES, content_type);
- DCHECK(content_settings::SupportsResourceIdentifier(content_type) ||
- resource_identifier.empty());
-
- if (ShouldAllowAllContent(secondary_url, content_type))
- return CONTENT_SETTING_ALLOW;
-
- // Iterate through the list of providers and return the first non-NULL value
- // that matches |primary_url| and |secondary_url|.
- for (ConstProviderIterator provider = content_settings_providers_.begin();
- provider != content_settings_providers_.end();
- ++provider) {
- ContentSetting provided_setting = content_settings::GetContentSetting(
- provider->second, primary_url, secondary_url, content_type,
- resource_identifier, is_off_the_record_);
- if (provided_setting != CONTENT_SETTING_DEFAULT)
- return provided_setting;
- }
- return CONTENT_SETTING_DEFAULT;
+ scoped_ptr<base::Value> value(GetContentSettingValue(
+ primary_url, secondary_url, content_type, resource_identifier,
+ NULL, NULL));
+ return content_settings::ValueToContentSetting(value.get());
}
-Value* HostContentSettingsMap::GetContentSettingValue(
+base::Value* HostContentSettingsMap::GetContentSettingValue(
const GURL& primary_url,
const GURL& secondary_url,
ContentSettingsType content_type,
- const std::string& resource_identifier) const {
+ const std::string& resource_identifier,
+ ContentSettingsPattern* primary_pattern,
+ ContentSettingsPattern* secondary_pattern) const {
+ DCHECK_NE(CONTENT_SETTINGS_TYPE_COOKIES, content_type);
+ DCHECK(content_settings::SupportsResourceIdentifier(content_type) ||
+ resource_identifier.empty());
+
// Check if the scheme of the requesting url is whitelisted.
if (ShouldAllowAllContent(secondary_url, content_type))
return Value::CreateIntegerValue(CONTENT_SETTING_ALLOW);
- // First check if there are specific settings for the |primary_url| and
- // |secondary_url|. The list of |content_settings_providers_| is ordered
- // according to their priority.
+ // The list of |content_settings_providers_| is ordered according to their
+ // precedence.
for (ConstProviderIterator provider = content_settings_providers_.begin();
provider != content_settings_providers_.end();
++provider) {
- // TODO(marja): Make DefaultProvider return NULL for
- // CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, un-skip default provider
- // here and remove the code below this loop.
- if (provider->first == DEFAULT_PROVIDER)
- continue;
- base::Value* value = content_settings::GetContentSettingValue(
+ base::Value* value = content_settings::GetContentSettingValueAndPatterns(
provider->second, primary_url, secondary_url, content_type,
- resource_identifier, is_off_the_record_);
+ resource_identifier, is_off_the_record_,
+ primary_pattern, secondary_pattern);
if (value)
return value;
}
- // If no specific settings were found for the |primary_url|, |secondary_url|
- // pair, then the default value for the given |content_type| should be
- // returned. For CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE the default is
- // 'no filter available'. That's why we return |NULL| for this content type.
- if (content_type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE)
- return NULL;
- return Value::CreateIntegerValue(GetDefaultContentSetting(content_type));
+ return NULL;
}
ContentSettings HostContentSettingsMap::GetContentSettings(

Powered by Google App Engine
This is Rietveld 408576698