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

Unified Diff: chrome/browser/dom_ui/options/content_settings_handler.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/dom_ui/options/content_settings_handler.cc
diff --git a/chrome/browser/dom_ui/options/content_settings_handler.cc b/chrome/browser/dom_ui/options/content_settings_handler.cc
index 3e5f8d37ba9a3c6d9cd53a8b01092dfe344f1e22..af1b063b405f5c9e15684a0d47f91da4b59b196b 100644
--- a/chrome/browser/dom_ui/options/content_settings_handler.cc
+++ b/chrome/browser/dom_ui/options/content_settings_handler.cc
@@ -368,8 +368,10 @@ void ContentSettingsHandler::Observe(NotificationType type,
void ContentSettingsHandler::UpdateSettingDefaultFromModel(
ContentSettingsType type) {
DictionaryValue filter_settings;
- filter_settings.SetString(ContentSettingsTypeToGroupName(type),
- GetSettingDefaultFromModel(type));
+ filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value",
+ GetSettingDefaultFromModel(type));
+ filter_settings.SetBoolean(ContentSettingsTypeToGroupName(type) + ".managed",
+ GetDefaultSettingManagedFromModel(type));
dom_ui_->CallJavascriptFunction(
L"ContentSettings.setContentFilterSettingsValue", filter_settings);
@@ -391,6 +393,19 @@ std::string ContentSettingsHandler::GetSettingDefaultFromModel(
return ContentSettingToString(default_setting);
}
+bool ContentSettingsHandler::GetDefaultSettingManagedFromModel(
+ ContentSettingsType type) {
+ if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
+ return dom_ui_->GetProfile()->
+ GetGeolocationContentSettingsMap()->IsDefaultContentSettingManaged();
+ } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
+ return dom_ui_->GetProfile()->
+ GetDesktopNotificationService()->IsDefaultContentSettingManaged();
+ } else {
+ return GetContentSettingsMap()->IsDefaultContentSettingManaged(type);
+ }
+}
+
void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() {
for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1;
type < CONTENT_SETTINGS_NUM_TYPES; ++type) {

Powered by Google App Engine
This is Rietveld 408576698