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

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: 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/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 33fd7c00164fa390d77b8b3fdcb8eefbe9e41508..29017f728076cfb9e72a291ffefa151dcb469678 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());
scoped_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 exception in settings.
+ bool maybe_enable_pref_exceptions =
+ map->GetMaybeEnablePrefExceptionsForType(content_type());
+ set_radio_group_enabled(maybe_enable_pref_exceptions);
+
selected_item_ = radio_group.default_item;
set_radio_group(radio_group);
}

Powered by Google App Engine
This is Rietveld 408576698