summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui/content_settings_handler.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 21:03:46 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 21:03:46 +0000
commit292829c20ddcb13e0480e1fe3f25039569c414f8 (patch)
tree9ec251abb96ebcadab63eaf606f70530829c8222 /chrome/browser/dom_ui/content_settings_handler.cc
parent9d350e8367dbce79d96f9dd8f22639f12b07a75c (diff)
downloadchromium_src-292829c20ddcb13e0480e1fe3f25039569c414f8.zip
chromium_src-292829c20ddcb13e0480e1fe3f25039569c414f8.tar.gz
chromium_src-292829c20ddcb13e0480e1fe3f25039569c414f8.tar.bz2
[Options DOMUI] More content settings exceptions work
BUG=48862 TEST=editing image exceptions works Review URL: http://codereview.chromium.org/2883045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/content_settings_handler.cc')
-rw-r--r--chrome/browser/dom_ui/content_settings_handler.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/dom_ui/content_settings_handler.cc b/chrome/browser/dom_ui/content_settings_handler.cc
index 884fbf9..a40d7e1 100644
--- a/chrome/browser/dom_ui/content_settings_handler.cc
+++ b/chrome/browser/dom_ui/content_settings_handler.cc
@@ -115,6 +115,8 @@ void ContentSettingsHandler::GetLocalizedValues(
l10n_util::GetString(IDS_EXCEPTIONS_ADD_BUTTON));
localized_strings->SetString(L"removeExceptionRow",
l10n_util::GetString(IDS_EXCEPTIONS_REMOVE_BUTTON));
+ localized_strings->SetString(L"editExceptionRow",
+ l10n_util::GetString(IDS_EXCEPTIONS_EDIT_BUTTON));
// Cookies filter.
localized_strings->SetString(L"cookies_tab_label",
@@ -284,6 +286,9 @@ void ContentSettingsHandler::RegisterMessages() {
dom_ui_->RegisterMessageCallback("removeImageExceptions",
NewCallback(this,
&ContentSettingsHandler::RemoveExceptions));
+ dom_ui_->RegisterMessageCallback("setImageException",
+ NewCallback(this,
+ &ContentSettingsHandler::SetException));
}
void ContentSettingsHandler::SetContentFilter(const Value* value) {
@@ -324,3 +329,21 @@ void ContentSettingsHandler::RemoveExceptions(const Value* value) {
CONTENT_SETTING_DEFAULT);
}
}
+
+// TODO(estade): generalize this function to work on all content settings types
+// rather than just images.
+void ContentSettingsHandler::SetException(const Value* value) {
+ const ListValue* list_value = static_cast<const ListValue*>(value);
+ std::string pattern;
+ bool rv = list_value->GetString(0, &pattern);
+ DCHECK(rv);
+ std::string setting;
+ rv = list_value->GetString(1, &setting);
+ DCHECK(rv);
+
+ HostContentSettingsMap* settings_map =
+ dom_ui_->GetProfile()->GetHostContentSettingsMap();
+ settings_map->SetContentSetting(HostContentSettingsMap::Pattern(pattern),
+ CONTENT_SETTINGS_TYPE_IMAGES,
+ ContentSettingFromString(setting));
+}