Chromium Code Reviews| 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 547f3d16bce0d27c974310945f1d5c0d9ed96ee9..59f473df136d50a8dbfa0c4bd0d58646ed2b9597 100644 |
| --- a/chrome/browser/gtk/options/content_filter_page_gtk.cc |
| +++ b/chrome/browser/gtk/options/content_filter_page_gtk.cc |
| @@ -7,6 +7,7 @@ |
| #include "app/l10n_util.h" |
| #include "base/command_line.h" |
| #include "chrome/browser/content_settings/content_settings_details.h" |
| +#include "chrome/browser/content_settings/content_settings_pattern.h" |
| #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
| #include "chrome/browser/geolocation/geolocation_exceptions_table_model.h" |
| #include "chrome/browser/plugin_exceptions_table_model.h" |
| @@ -157,6 +158,10 @@ 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()); |
| + registrar_.Add(this, NotificationType::GEOLOCATION_SETTINGS_CHANGED, |
| + NotificationService::AllSources()); |
| return vbox; |
| } |
| @@ -164,15 +169,24 @@ 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(); |
| + sensitive = !profile()->GetGeolocationContentSettingsMap()-> |
| + IsDefaultContentSettingManaged(); |
| } 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) { |
| @@ -186,8 +200,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_) |
| @@ -280,6 +292,15 @@ void ContentFilterPageGtk::Observe(NotificationType type, |
| if (type == NotificationType::CONTENT_SETTINGS_CHANGED) { |
| NotifyContentSettingsChanged( |
| Details<const ContentSettingsDetails>(details).ptr()); |
| + } else if (type == NotificationType::GEOLOCATION_SETTINGS_CHANGED) { |
| + NotifyContentSettingsChanged( |
| + Details<const ContentSettingsDetails>(details).ptr()); |
| + } else if (type == NotificationType::DESKTOP_NOTIFICATION_DEFAULT_CHANGED) { |
| + ContentSettingsDetails content_settings_details( |
|
danno
2010/12/15 15:54:07
nit: remove extra leading space here.
markusheintz_
2010/12/15 18:07:20
Done.
|
| + ContentSettingsPattern(), |
|
Nico
2010/12/15 15:30:05
indent needs one more space
markusheintz_
2010/12/15 18:07:20
not needed anymore after removing the extra space.
|
| + CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| + ""); |
| + NotifyContentSettingsChanged(&content_settings_details); |
| } else { |
| OptionsPageBase::Observe(type, source, details); |
| } |