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

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

Issue 5964003: Content settings lists moved to sub-sub pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix syntax 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 af1b063b405f5c9e15684a0d47f91da4b59b196b..837afb619fce3464b9fc43125b2f3b062571e8f7 100644
--- a/chrome/browser/dom_ui/options/content_settings_handler.cc
+++ b/chrome/browser/dom_ui/options/content_settings_handler.cc
@@ -200,10 +200,14 @@ void ContentSettingsHandler::GetLocalizedValues(
l10n_util::GetStringUTF16(IDS_EXCEPTIONS_PATTERN_EXAMPLE));
localized_strings->SetString("addNewExceptionInstructions",
l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ADD_NEW_INSTRUCTIONS));
+ localized_strings->SetString("manage_exceptions",
+ l10n_util::GetStringUTF16(IDS_EXCEPTIONS_MANAGE));
// Cookies filter.
localized_strings->SetString("cookies_tab_label",
l10n_util::GetStringUTF16(IDS_COOKIES_TAB_LABEL));
+ localized_strings->SetString("cookies_header",
+ l10n_util::GetStringUTF16(IDS_COOKIES_HEADER));
localized_strings->SetString("cookies_allow",
l10n_util::GetStringUTF16(IDS_COOKIES_ALLOW_RADIO));
localized_strings->SetString("cookies_ask",
@@ -224,6 +228,8 @@ void ContentSettingsHandler::GetLocalizedValues(
// Image filter.
localized_strings->SetString("images_tab_label",
l10n_util::GetStringUTF16(IDS_IMAGES_TAB_LABEL));
+ localized_strings->SetString("images_header",
+ l10n_util::GetStringUTF16(IDS_IMAGES_HEADER));
localized_strings->SetString("images_allow",
l10n_util::GetStringUTF16(IDS_IMAGES_LOAD_RADIO));
localized_strings->SetString("images_block",
@@ -232,6 +238,8 @@ void ContentSettingsHandler::GetLocalizedValues(
// JavaScript filter.
localized_strings->SetString("javascript_tab_label",
l10n_util::GetStringUTF16(IDS_JAVASCRIPT_TAB_LABEL));
+ localized_strings->SetString("javascript_header",
+ l10n_util::GetStringUTF16(IDS_JAVASCRIPT_HEADER));
localized_strings->SetString("javascript_allow",
l10n_util::GetStringUTF16(IDS_JS_ALLOW_RADIO));
localized_strings->SetString("javascript_block",
@@ -240,6 +248,8 @@ void ContentSettingsHandler::GetLocalizedValues(
// Plug-ins filter.
localized_strings->SetString("plugins_tab_label",
l10n_util::GetStringUTF16(IDS_PLUGIN_TAB_LABEL));
+ localized_strings->SetString("plugins_header",
+ l10n_util::GetStringUTF16(IDS_PLUGIN_HEADER));
localized_strings->SetString("plugins_ask",
l10n_util::GetStringUTF16(IDS_PLUGIN_ASK_RADIO));
localized_strings->SetString("plugins_allow",
@@ -252,10 +262,11 @@ void ContentSettingsHandler::GetLocalizedValues(
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableClickToPlay));
-
// Pop-ups filter.
localized_strings->SetString("popups_tab_label",
l10n_util::GetStringUTF16(IDS_POPUP_TAB_LABEL));
+ localized_strings->SetString("popups_header",
+ l10n_util::GetStringUTF16(IDS_POPUP_HEADER));
localized_strings->SetString("popups_allow",
l10n_util::GetStringUTF16(IDS_POPUP_ALLOW_RADIO));
localized_strings->SetString("popups_block",
@@ -264,6 +275,8 @@ void ContentSettingsHandler::GetLocalizedValues(
// Location filter.
localized_strings->SetString("location_tab_label",
l10n_util::GetStringUTF16(IDS_GEOLOCATION_TAB_LABEL));
+ localized_strings->SetString("location_header",
+ l10n_util::GetStringUTF16(IDS_GEOLOCATION_HEADER));
localized_strings->SetString("location_allow",
l10n_util::GetStringUTF16(IDS_GEOLOCATION_ALLOW_RADIO));
localized_strings->SetString("location_ask",
@@ -274,6 +287,8 @@ void ContentSettingsHandler::GetLocalizedValues(
// Notifications filter.
localized_strings->SetString("notifications_tab_label",
l10n_util::GetStringUTF16(IDS_NOTIFICATIONS_TAB_LABEL));
+ localized_strings->SetString("notifications_header",
+ l10n_util::GetStringUTF16(IDS_NOTIFICATIONS_HEADER));
localized_strings->SetString("notifications_allow",
l10n_util::GetStringUTF16(IDS_NOTIFICATIONS_ALLOW_RADIO));
localized_strings->SetString("notifications_ask",
@@ -319,8 +334,10 @@ void ContentSettingsHandler::Observe(NotificationType type,
switch (type.value) {
case NotificationType::PROFILE_DESTROYED: {
Profile* profile = static_cast<Source<Profile> >(source).ptr();
- if (profile->IsOffTheRecord())
- dom_ui_->CallJavascriptFunction(L"ContentSettings.OTRProfileDestroyed");
+ if (profile->IsOffTheRecord()) {
+ dom_ui_->CallJavascriptFunction(
+ L"ContentSettingsExceptionsArea.OTRProfileDestroyed");
+ }
break;
}
@@ -555,9 +572,9 @@ void ContentSettingsHandler::RegisterMessages() {
dom_ui_->RegisterMessageCallback("setAllowThirdPartyCookies",
NewCallback(this,
&ContentSettingsHandler::SetAllowThirdPartyCookies));
- dom_ui_->RegisterMessageCallback("removeExceptions",
+ dom_ui_->RegisterMessageCallback("removeException",
NewCallback(this,
- &ContentSettingsHandler::RemoveExceptions));
+ &ContentSettingsHandler::RemoveException));
dom_ui_->RegisterMessageCallback("setException",
NewCallback(this,
&ContentSettingsHandler::SetException));
@@ -598,62 +615,60 @@ void ContentSettingsHandler::SetAllowThirdPartyCookies(const ListValue* args) {
GetContentSettingsMap()->SetBlockThirdPartyCookies(allow == L"true");
}
-void ContentSettingsHandler::RemoveExceptions(const ListValue* args) {
+void ContentSettingsHandler::RemoveException(const ListValue* args) {
size_t arg_i = 0;
std::string type_string;
CHECK(args->GetString(arg_i++, &type_string));
ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string);
- while (arg_i < args->GetSize()) {
- if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
- std::string origin;
- std::string embedding_origin;
- bool rv = args->GetString(arg_i++, &origin);
- DCHECK(rv);
- rv = args->GetString(arg_i++, &embedding_origin);
- DCHECK(rv);
-
- dom_ui_->GetProfile()->GetGeolocationContentSettingsMap()->
- SetContentSetting(GURL(origin),
- GURL(embedding_origin),
- CONTENT_SETTING_DEFAULT);
- } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
- std::string origin;
- std::string setting;
- bool rv = args->GetString(arg_i++, &origin);
- DCHECK(rv);
- rv = args->GetString(arg_i++, &setting);
- DCHECK(rv);
- ContentSetting content_setting = ContentSettingFromString(setting);
- if (content_setting == CONTENT_SETTING_ALLOW) {
- dom_ui_->GetProfile()->GetDesktopNotificationService()->
- ResetAllowedOrigin(GURL(origin));
- } else {
- DCHECK_EQ(content_setting, CONTENT_SETTING_BLOCK);
- dom_ui_->GetProfile()->GetDesktopNotificationService()->
- ResetBlockedOrigin(GURL(origin));
- }
+ if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
+ std::string origin;
+ std::string embedding_origin;
+ bool rv = args->GetString(arg_i++, &origin);
+ DCHECK(rv);
+ rv = args->GetString(arg_i++, &embedding_origin);
+ DCHECK(rv);
+
+ dom_ui_->GetProfile()->GetGeolocationContentSettingsMap()->
+ SetContentSetting(GURL(origin),
+ GURL(embedding_origin),
+ CONTENT_SETTING_DEFAULT);
+ } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
+ std::string origin;
+ std::string setting;
+ bool rv = args->GetString(arg_i++, &origin);
+ DCHECK(rv);
+ rv = args->GetString(arg_i++, &setting);
+ DCHECK(rv);
+ ContentSetting content_setting = ContentSettingFromString(setting);
+ if (content_setting == CONTENT_SETTING_ALLOW) {
+ dom_ui_->GetProfile()->GetDesktopNotificationService()->
+ ResetAllowedOrigin(GURL(origin));
} else {
- std::string mode;
- bool rv = args->GetString(arg_i++, &mode);
- DCHECK(rv);
-
- std::string pattern;
- rv = args->GetString(arg_i++, &pattern);
- DCHECK(rv);
-
- HostContentSettingsMap* settings_map =
- mode == "normal" ? GetContentSettingsMap() :
- GetOTRContentSettingsMap();
- // The settings map could be null if the mode was OTR but the OTR profile
- // got destroyed before we received this message.
- if (settings_map) {
- settings_map->SetContentSetting(
- ContentSettingsPattern(pattern),
- ContentSettingsTypeFromGroupName(type_string),
- "",
- CONTENT_SETTING_DEFAULT);
- }
+ DCHECK_EQ(content_setting, CONTENT_SETTING_BLOCK);
+ dom_ui_->GetProfile()->GetDesktopNotificationService()->
+ ResetBlockedOrigin(GURL(origin));
+ }
+ } else {
+ std::string mode;
+ bool rv = args->GetString(arg_i++, &mode);
+ DCHECK(rv);
+
+ std::string pattern;
+ rv = args->GetString(arg_i++, &pattern);
+ DCHECK(rv);
+
+ HostContentSettingsMap* settings_map =
+ mode == "normal" ? GetContentSettingsMap() :
+ GetOTRContentSettingsMap();
+ // The settings map could be null if the mode was OTR but the OTR profile
+ // got destroyed before we received this message.
+ if (settings_map) {
+ settings_map->SetContentSetting(
+ ContentSettingsPattern(pattern),
+ ContentSettingsTypeFromGroupName(type_string),
+ "",
+ CONTENT_SETTING_DEFAULT);
}
}
}
« no previous file with comments | « chrome/browser/dom_ui/options/content_settings_handler.h ('k') | chrome/browser/resources/options/content_settings.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698