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

Unified Diff: components/content_settings/core/browser/content_settings_info.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
Index: components/content_settings/core/browser/content_settings_info.cc
diff --git a/components/content_settings/core/browser/content_settings_info.cc b/components/content_settings/core/browser/content_settings_info.cc
index c111944e2860537d8a054e57ce2345cbe5dd948a..41fd1375bb032ae2c5dd471053bc6fb2f8b116d1 100644
--- a/components/content_settings/core/browser/content_settings_info.cc
+++ b/components/content_settings/core/browser/content_settings_info.cc
@@ -5,6 +5,7 @@
#include "components/content_settings/core/browser/content_settings_info.h"
#include "base/stl_util.h"
+#include "components/content_settings/core/browser/website_settings_info.h"
namespace content_settings {
@@ -24,4 +25,26 @@ bool ContentSettingsInfo::IsSettingValid(ContentSetting setting) const {
return base::ContainsKey(valid_settings_, setting);
}
+// TODO(raymes): Find a better way to deal with the special-casing in
+// IsDefaultSettingValid.
+bool ContentSettingsInfo::IsDefaultSettingValid(ContentSetting setting) const {
+ ContentSettingsType type = website_settings_info_->type();
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+ // Don't support ALLOW for protected media default setting until migration.
+ if (type == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER &&
+ setting == CONTENT_SETTING_ALLOW) {
+ return false;
+ }
+#endif
+
+ // Don't support ALLOW for the default media settings.
+ if ((type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA ||
+ type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) &&
+ setting == CONTENT_SETTING_ALLOW) {
+ return false;
+ }
+
+ return base::ContainsKey(valid_settings_, setting);
+}
+
} // namespace content_settings

Powered by Google App Engine
This is Rietveld 408576698