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

Unified Diff: chrome/browser/ui/content_settings/content_setting_bubble_model.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: Sync; compile fix in PolicyProvider::GetUserExceptionsUsageSettingForType(). 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/content_settings/content_setting_bubble_model.cc
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
index 525410cd7ac64bbe61a81541991868d353fb70cb..7c151c0673e6896ede7246283630c1f5801f82a3 100644
--- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
+++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc
@@ -326,6 +326,8 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() {
SettingSource setting_source = SETTING_SOURCE_NONE;
bool setting_is_wildcard = false;
+ HostContentSettingsMap* map =
+ HostContentSettingsMapFactory::GetForProfile(profile());
if (content_type() == CONTENT_SETTINGS_TYPE_COOKIES) {
content_settings::CookieSettings* cookie_settings =
CookieSettingsFactory::GetForProfile(profile()).get();
@@ -333,8 +335,6 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() {
url, url, true, &setting_source);
} else {
SettingInfo info;
- HostContentSettingsMap* map =
- HostContentSettingsMapFactory::GetForProfile(profile());
std::unique_ptr<base::Value> value =
map->GetWebsiteSetting(url, url, content_type(), std::string(), &info);
setting = content_settings::ValueToContentSetting(value.get());
@@ -361,11 +361,12 @@ void ContentSettingSingleRadioGroup::SetRadioGroup() {
set_setting_is_managed(setting_source != SETTING_SOURCE_USER &&
setting != CONTENT_SETTING_ASK);
- if (setting_source != SETTING_SOURCE_USER) {
- set_radio_group_enabled(false);
- } else {
- set_radio_group_enabled(true);
- }
+
+ // Radio buttons are enabled iff user can edit exceptions in settings.
+ bool user_exception_allowed =
+ map->AreUserExceptionsAllowedForType(content_type());
+ set_radio_group_enabled(user_exception_allowed);
+
selected_item_ = radio_group.default_item;
set_radio_group(radio_group);
}

Powered by Google App Engine
This is Rietveld 408576698