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

Unified Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 1865803002: [Policy Experimental] Add policies to allow Cookies and Pop-ups exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add another test to exercise main logic; renames from review. Created 4 years, 8 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/ui/webui/options/content_settings_handler.cc
diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc
index 69c929d2a2a68985dc5cc71af2d83a3792132c5b..f191f082962de4ebd0e59101989e6586f23085e2 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -876,6 +876,16 @@ void ContentSettingsHandler::UpdateSettingDefaultFromModel(
web_ui()->CallJavascriptFunction(
"ContentSettings.setContentFilterSettingsValue", filter_settings);
+
+ // The special cases covered agive to get |provider_id| are not handled in
Bernhard Bauer 2016/04/07 15:30:13 "agive" seems like a typo, and I can't make out wh
huangs 2016/04/07 21:44:06 Fixed ("agive" => "above").
Bernhard Bauer 2016/04/08 14:44:35 Oh, that makes sense (and it's not that far apart
huangs 2016/04/11 19:01:03 Acknowledged. :)
+ // GetMaybeEnablePrefExceptionsForType().
+ bool maybe_enable_exceptions =
+ GetContentSettingsMap()->GetMaybeEnablePrefExceptionsForType(type);
+
+ web_ui()->CallJavascriptFunction(
+ "ContentSettings.setAllowEnablePrefExceptions",
+ base::StringValue(ContentSettingsTypeToGroupName(type)),
+ base::FundamentalValue(maybe_enable_exceptions));
}
void ContentSettingsHandler::UpdateMediaSettingsFromPrefs(
@@ -961,8 +971,7 @@ void ContentSettingsHandler::UpdateGeolocationExceptionsView() {
// Don't add default settings.
if (i->primary_pattern == ContentSettingsPattern::Wildcard() &&
i->secondary_pattern == ContentSettingsPattern::Wildcard() &&
- i
- ->source != site_settings::kPreferencesSource) {
+ i->source != site_settings::kPreferencesSource) {
continue;
}
all_patterns_settings[std::make_pair(i->primary_pattern, i->source)]
@@ -1473,6 +1482,12 @@ void ContentSettingsHandler::RemoveException(const base::ListValue* args) {
std::string type_string;
CHECK(args->GetString(0, &type_string));
+ ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string);
+
+ // If preference exceptions are disabled for |type|, don't remove.
+ if (!GetContentSettingsMap()->GetMaybeEnablePrefExceptionsForType(type))
+ return;
+
// Zoom levels are no actual content type so we need to handle them
// separately. They would not be recognized by
// ContentSettingsTypeFromGroupName.
@@ -1488,7 +1503,6 @@ void ContentSettingsHandler::RemoveException(const base::ListValue* args) {
return;
}
- ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string);
RemoveExceptionFromHostContentSettingsMap(args, type);
WebSiteSettingsUmaUtil::LogPermissionChange(
@@ -1512,6 +1526,10 @@ void ContentSettingsHandler::SetException(const base::ListValue* args) {
type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) {
NOTREACHED();
} else {
+ // If preference exceptions are disabled for |type|, don't set.
+ if (!GetContentSettingsMap()->GetMaybeEnablePrefExceptionsForType(type))
+ return;
+
HostContentSettingsMap* settings_map =
mode == "normal" ? GetContentSettingsMap() :
GetOTRContentSettingsMap();

Powered by Google App Engine
This is Rietveld 408576698