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

Unified Diff: components/content_settings/core/browser/host_content_settings_map.cc

Issue 2853983002: Ensure settings returned from Content Settings providers are valid (Closed)
Patch Set: Ensure settings returned from Content Settings providers are valid Created 3 years, 7 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
« no previous file with comments | « components/content_settings/core/browser/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: components/content_settings/core/browser/host_content_settings_map.cc
diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc
index 3c6d765bc8c840112596c8d8c3af6545ba8044c4..de7e9f3797486456d79f9405473013160921ab78 100644
--- a/components/content_settings/core/browser/host_content_settings_map.cc
+++ b/components/content_settings/core/browser/host_content_settings_map.cc
@@ -349,7 +349,9 @@ void HostContentSettingsMap::SetDefaultContentSetting(
std::unique_ptr<base::Value> value;
// A value of CONTENT_SETTING_DEFAULT implies deleting the content setting.
if (setting != CONTENT_SETTING_DEFAULT) {
- DCHECK(IsDefaultSettingAllowedForType(setting, content_type));
+ DCHECK(content_settings::ContentSettingsRegistry::GetInstance()
+ ->Get(content_type)
+ ->IsDefaultSettingValid(setting));
value.reset(new base::Value(setting));
}
SetWebsiteSettingCustomScope(ContentSettingsPattern::Wildcard(),
@@ -685,35 +687,6 @@ void HostContentSettingsMap::ClearSettingsForOneTypeWithPredicate(
}
}
-// TODO(raymes): Remove this function. Consider making it a property of
-// ContentSettingsInfo or removing it altogether (it's unclear whether we should
-// be restricting allowed default values at this layer).
-// static
-bool HostContentSettingsMap::IsDefaultSettingAllowedForType(
- ContentSetting setting,
- ContentSettingsType content_type) {
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
- // Don't support ALLOW for protected media default setting until migration.
- if (content_type == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER &&
- setting == CONTENT_SETTING_ALLOW) {
- return false;
- }
-#endif
-
- // Don't support ALLOW for the default media settings.
- if ((content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA ||
- content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) &&
- setting == CONTENT_SETTING_ALLOW) {
- return false;
- }
-
- const content_settings::ContentSettingsInfo* info =
- content_settings::ContentSettingsRegistry::GetInstance()->Get(
- content_type);
- DCHECK(info);
- return info->IsSettingValid(setting);
-}
-
void HostContentSettingsMap::OnContentSettingChanged(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
@@ -813,11 +786,8 @@ std::unique_ptr<base::Value> HostContentSettingsMap::GetWebsiteSetting(
}
}
- return GetWebsiteSettingInternal(primary_url,
- secondary_url,
- content_type,
- resource_identifier,
- info);
+ return GetWebsiteSettingInternal(primary_url, secondary_url, content_type,
+ resource_identifier, info);
}
// static
« no previous file with comments | « components/content_settings/core/browser/host_content_settings_map.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698