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..a165d4aa0156bce44d32729ecda561899aeb48e0 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,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; |
| } |
| @@ -164,15 +167,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 +198,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_) |
| @@ -257,6 +267,7 @@ void ContentFilterPageGtk::OnExceptionsClicked(GtkWidget* button) { |
| switches::kEnableResourceContentSettings)) { |
| PluginExceptionsTableModel* model = |
| new PluginExceptionsTableModel(settings_map, otr_settings_map); |
| + |
|
jochen (gone - plz use gerrit)
2010/12/07 09:43:52
why the newline?
markusheintz_
2010/12/07 11:46:15
sry. removed the newline. looks like an accident.
|
| model->LoadSettings(); |
| SimpleContentExceptionsWindow::ShowExceptionsWindow( |
| GTK_WINDOW(gtk_widget_get_toplevel(button)), |
| @@ -280,6 +291,12 @@ void ContentFilterPageGtk::Observe(NotificationType type, |
| if (type == NotificationType::CONTENT_SETTINGS_CHANGED) { |
| NotifyContentSettingsChanged( |
| Details<const ContentSettingsDetails>(details).ptr()); |
| + } else if (type == NotificationType::DESKTOP_NOTIFICATION_DEFAULT_CHANGED) { |
| + ContentSettingsDetails content_settings_details( |
| + ContentSettingsPattern(), |
| + CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
| + ""); |
| + NotifyContentSettingsChanged(&content_settings_details); |
| } else { |
| OptionsPageBase::Observe(type, source, details); |
| } |