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

Unified Diff: chrome/browser/gtk/options/content_filter_page_gtk.cc

Issue 5398001: Allow default desktop content settings to be managed via policy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove Cocoa UI-changes Created 10 years 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/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..13aeb051dbd7dab7a5688f518d0da9800bd33a23 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_)
@@ -276,10 +288,18 @@ void ContentFilterPageGtk::OnPluginsPageLinkClicked(GtkWidget* button) {
void ContentFilterPageGtk::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
-
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(
+ ContentSettingsPattern(),
+ CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ "");
+ NotifyContentSettingsChanged(&content_settings_details);
} else {
OptionsPageBase::Observe(type, source, details);
}

Powered by Google App Engine
This is Rietveld 408576698