Index: chrome/browser/gtk/options/content_filter_page_gtk.cc |
diff --git a/chrome/browser/gtk/options/content_filter_page_gtk.cc b/chrome/browser/gtk/options/content_filter_page_gtk.cc |
index 21387a591a77e43c26820e44ee084735edb7c111..370764de97a5569e8de8f2d5545b3fe7cbd0875b 100644 |
--- a/chrome/browser/gtk/options/content_filter_page_gtk.cc |
+++ b/chrome/browser/gtk/options/content_filter_page_gtk.cc |
@@ -156,6 +156,8 @@ GtkWidget* ContentFilterPageGtk::InitGroup() { |
// aften content settings change. |
registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, |
NotificationService::AllSources()); |
+ registrar_.Add(this, NotificationType::DESKTOP_NOTIFICATION_DEFAULT_CHANGED, |
+ NotificationService::AllSources()); |
return vbox; |
} |
@@ -163,15 +165,22 @@ GtkWidget* ContentFilterPageGtk::InitGroup() { |
void ContentFilterPageGtk::UpdateButtonsState() { |
// Get default_setting. |
ContentSetting default_setting; |
+ // If the content setting is managed, sensitive is set to false and the radio |
+ // buttons will be disabled. |
+ bool sensitive = true; |
if (content_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION) { |
default_setting = profile()->GetGeolocationContentSettingsMap()-> |
GetDefaultContentSetting(); |
} else if (content_type_ == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { |
default_setting = profile()->GetDesktopNotificationService()-> |
GetDefaultContentSetting(); |
+ sensitive = !profile()->GetDesktopNotificationService()-> |
+ IsDefaultContentSettingManaged(); |
} else { |
default_setting = profile()->GetHostContentSettingsMap()-> |
GetDefaultContentSetting(content_type_); |
+ sensitive = !profile()->GetHostContentSettingsMap()-> |
+ IsDefaultContentSettingManaged(content_type_); |
} |
// Set UI state. |
if (default_setting == CONTENT_SETTING_ALLOW) { |
@@ -185,8 +194,6 @@ void ContentFilterPageGtk::UpdateButtonsState() { |
} |
// Disable the UI if the default content setting is managed. |
- bool sensitive = !profile()->GetHostContentSettingsMap()-> |
- IsDefaultContentSettingManaged(content_type_); |
gtk_widget_set_sensitive(allow_radio_, sensitive); |
gtk_widget_set_sensitive(block_radio_, sensitive); |
if (ask_radio_) |
@@ -279,6 +286,12 @@ void ContentFilterPageGtk::Observe(NotificationType type, |
if (type == NotificationType::CONTENT_SETTINGS_CHANGED) { |
NotifyContentSettingsChanged( |
Details<HostContentSettingsMap::ContentSettingsDetails>(details).ptr()); |
+ } else if (type == NotificationType::DESKTOP_NOTIFICATION_DEFAULT_CHANGED) { |
+ HostContentSettingsMap::ContentSettingsDetails content_settings_details( |
+ HostContentSettingsMap::Pattern(), |
+ CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
+ ""); |
+ NotifyContentSettingsChanged(&content_settings_details); |
} else { |
OptionsPageBase::Observe(type, source, details); |
} |