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

Unified Diff: chrome/browser/dom_ui/content_settings_handler.cc

Issue 2883045: More content settings exceptions (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: %s/S/s Created 10 years, 5 months 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/content_settings_handler.cc
diff --git a/chrome/browser/dom_ui/content_settings_handler.cc b/chrome/browser/dom_ui/content_settings_handler.cc
index 884fbf965cf8235d5903f1e3a09ef9a0b5711280..a40d7e11b3cbbe08ae6ff5268dc3a3120c03c64b 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));
+}

Powered by Google App Engine
This is Rietveld 408576698