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

Unified Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 528333002: Make it possible to revoke Web Notification exceptions in content settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « chrome/browser/resources/options/content_settings_exceptions_area.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/content_settings_handler.cc
diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc
index 8515bb986d080aa94d48e40a43105471987b3d33..265318a9ddf68976b74f4cffdf0c352ee567cf37 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -174,12 +174,18 @@ base::DictionaryValue* GetGeolocationExceptionForPage(
// in the desktop notifications exceptions table. Ownership of the pointer is
// passed to the caller.
base::DictionaryValue* GetNotificationExceptionForPage(
- const ContentSettingsPattern& pattern,
+ const ContentSettingsPattern& primary_pattern,
+ const ContentSettingsPattern& secondary_pattern,
ContentSetting setting,
const std::string& provider_name) {
+ std::string embedding_origin;
+ if (secondary_pattern != ContentSettingsPattern::Wildcard())
+ embedding_origin = secondary_pattern.ToString();
+
base::DictionaryValue* exception = new base::DictionaryValue();
exception->SetString(kSetting, ContentSettingToString(setting));
- exception->SetString(kOrigin, pattern.ToString());
+ exception->SetString(kOrigin, primary_pattern.ToString());
+ exception->SetString(kEmbeddingOrigin, embedding_origin);
exception->SetString(kSource, provider_name);
return exception;
}
@@ -841,7 +847,9 @@ void ContentSettingsHandler::UpdateNotificationExceptionsView() {
}
exceptions.Append(
- GetNotificationExceptionForPage(i->primary_pattern, i->setting,
+ GetNotificationExceptionForPage(i->primary_pattern,
+ i->secondary_pattern,
+ i->setting,
i->source));
}
@@ -1127,24 +1135,6 @@ void ContentSettingsHandler::GetExceptionsFromHostContentSettingsMap(
}
}
-void ContentSettingsHandler::RemoveNotificationException(
- const base::ListValue* args) {
- Profile* profile = Profile::FromWebUI(web_ui());
-
- std::string origin;
- std::string setting;
- bool rv = args->GetString(1, &origin);
- DCHECK(rv);
- rv = args->GetString(2, &setting);
- DCHECK(rv);
- ContentSetting content_setting = ContentSettingFromString(setting);
-
- DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
- content_setting == CONTENT_SETTING_BLOCK);
- DesktopNotificationProfileUtil::ClearSetting(profile,
- ContentSettingsPattern::FromString(origin));
-}
-
void ContentSettingsHandler::RemoveMediaException(const base::ListValue* args) {
std::string mode;
bool rv = args->GetString(1, &mode);
@@ -1327,17 +1317,10 @@ void ContentSettingsHandler::RemoveException(const base::ListValue* args) {
}
ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string);
- switch (type) {
- case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
- RemoveNotificationException(args);
- break;
- case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
- RemoveMediaException(args);
- break;
- default:
- RemoveExceptionFromHostContentSettingsMap(args, type);
- break;
- }
+ if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM)
+ RemoveMediaException(args);
+ else
+ RemoveExceptionFromHostContentSettingsMap(args, type);
}
void ContentSettingsHandler::SetException(const base::ListValue* args) {
« no previous file with comments | « chrome/browser/resources/options/content_settings_exceptions_area.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698