Chromium Code Reviews| 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..5809de49cb55536008caf042ce9af004e5067003 100644 |
| --- a/chrome/browser/ui/webui/options/content_settings_handler.cc |
| +++ b/chrome/browser/ui/webui/options/content_settings_handler.cc |
| @@ -174,12 +174,17 @@ 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) { |
| 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, |
| + secondary_pattern == ContentSettingsPattern::Wildcard() ? |
| + std::string() : |
|
Bernhard Bauer
2014/09/11 14:56:35
Nit: I would probably use a local variable for thi
Peter Beverloo
2014/09/11 15:30:43
Done.
|
| + secondary_pattern.ToString()); |
| exception->SetString(kSource, provider_name); |
| return exception; |
| } |
| @@ -841,7 +846,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 +1134,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 +1316,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) { |