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

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

Issue 8539004: Replace SetContentSetting method of the content_settings::Provider interface with GetWebsiteSetting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase onto origin/trunk Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/content_settings/host_content_settings_map.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2c09ad2d3bab9c55f11107c064701faa037cf54c..db119abc12f8dc404449aad34188db3939c7db7a 100644
--- a/chrome/browser/content_settings/host_content_settings_map.cc
+++ b/chrome/browser/content_settings/host_content_settings_map.cc
@@ -210,34 +210,53 @@ void HostContentSettingsMap::SetDefaultContentSetting(
DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE);
DCHECK(IsSettingAllowedForType(setting, content_type));
- content_settings_providers_[DEFAULT_PROVIDER]->SetContentSetting(
+ base::Value* value = Value::CreateIntegerValue(setting);
+ content_settings_providers_[DEFAULT_PROVIDER]->SetWebsiteSetting(
ContentSettingsPattern::Wildcard(),
ContentSettingsPattern::Wildcard(),
content_type,
std::string(),
- setting);
+ value);
}
-void HostContentSettingsMap::SetContentSetting(
+void HostContentSettingsMap::SetWebsiteSetting(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_type,
const std::string& resource_identifier,
- ContentSetting setting) {
- DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE);
- DCHECK(IsSettingAllowedForType(setting, content_type));
+ base::Value* value) {
+ DCHECK(IsValueAllowedForType(value, content_type));
DCHECK(content_settings::SupportsResourceIdentifier(content_type) ||
resource_identifier.empty());
for (ProviderIterator provider = content_settings_providers_.begin();
provider != content_settings_providers_.end();
++provider) {
- provider->second->SetContentSetting(
- primary_pattern,
- secondary_pattern,
- content_type,
- resource_identifier,
- setting);
+ if (provider->second->SetWebsiteSetting(primary_pattern,
+ secondary_pattern,
+ content_type,
+ resource_identifier,
+ value)) {
+ return;
+ }
}
+ NOTREACHED();
+}
+
+void HostContentSettingsMap::SetContentSetting(
+ const ContentSettingsPattern& primary_pattern,
+ const ContentSettingsPattern& secondary_pattern,
+ ContentSettingsType content_type,
+ const std::string& resource_identifier,
+ ContentSetting setting) {
+ DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE);
+ base::Value* value = NULL;
+ if (setting != CONTENT_SETTING_DEFAULT)
+ value = Value::CreateIntegerValue(setting);
+ SetWebsiteSetting(primary_pattern,
+ secondary_pattern,
+ content_type,
+ resource_identifier,
+ value);
}
void HostContentSettingsMap::AddExceptionForURL(
@@ -274,6 +293,12 @@ void HostContentSettingsMap::ClearSettingsForOneType(
}
}
+bool HostContentSettingsMap::IsValueAllowedForType(
+ const base::Value* value, ContentSettingsType type) {
+ return IsSettingAllowedForType(
+ content_settings::ValueToContentSetting(value), type);
+}
+
// static
bool HostContentSettingsMap::IsSettingAllowedForType(
ContentSetting setting, ContentSettingsType content_type) {
« no previous file with comments | « chrome/browser/content_settings/host_content_settings_map.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698