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 990daf5487d587a0cd3dbdabe0bc8aa3914e6e2c..63ec5b431d0dad7577529d04b3a98e4eedf7a144 100644 |
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc |
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc |
@@ -30,6 +30,8 @@ |
#include "chrome/browser/extensions/extension_special_storage_policy.h" |
#include "chrome/browser/notifications/desktop_notification_profile_util.h" |
#include "chrome/browser/permissions/chooser_context_base.h" |
+#include "chrome/browser/permissions/permission_uma_util.h" |
+#include "chrome/browser/permissions/permission_util.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/browser_list.h" |
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
@@ -1297,9 +1299,9 @@ void ContentSettingsHandler::RemoveExceptionFromHostContentSettingsMap( |
DCHECK(rv); |
// The fourth argument to this handler is optional. |
- std::string secondary_pattern; |
+ std::string secondary_pattern_string; |
if (args->GetSize() >= 4U) { |
- rv = args->GetString(3, &secondary_pattern); |
+ rv = args->GetString(3, &secondary_pattern_string); |
DCHECK(rv); |
} |
@@ -1307,12 +1309,22 @@ void ContentSettingsHandler::RemoveExceptionFromHostContentSettingsMap( |
mode == "normal" ? GetContentSettingsMap() : |
GetOTRContentSettingsMap(); |
if (settings_map) { |
- settings_map->SetContentSettingCustomScope( |
- ContentSettingsPattern::FromString(pattern), |
- secondary_pattern.empty() |
+ Profile* profile = Profile::FromWebUI(web_ui()); |
+ if (mode != "normal") |
+ profile = profile->GetOffTheRecordProfile(); |
raymes
2016/07/26 07:50:03
I think we should probably simplify this - possibl
stefanocs
2016/07/26 12:00:05
Done.
|
+ ContentSettingsPattern primary_pattern = |
+ ContentSettingsPattern::FromString(pattern); |
+ ContentSettingsPattern secondary_pattern = |
+ secondary_pattern_string.empty() |
? ContentSettingsPattern::Wildcard() |
- : ContentSettingsPattern::FromString(secondary_pattern), |
- type, std::string(), CONTENT_SETTING_DEFAULT); |
+ : ContentSettingsPattern::FromString(secondary_pattern_string); |
+ PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter( |
+ profile, primary_pattern, secondary_pattern, type, |
+ PermissionSourceUI::SITE_SETTINGS); |
+ |
+ settings_map->SetContentSettingCustomScope( |
+ primary_pattern, secondary_pattern, type, std::string(), |
+ CONTENT_SETTING_DEFAULT); |
} |
} |
@@ -1482,6 +1494,15 @@ void ContentSettingsHandler::SetException(const base::ListValue* args) { |
content_settings::ContentSettingFromString(setting, &setting_type); |
DCHECK(result); |
+ Profile* profile = Profile::FromWebUI(web_ui()); |
+ if (mode != "normal") |
+ profile = profile->GetOffTheRecordProfile(); |
+ |
+ PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter( |
+ profile, ContentSettingsPattern::FromString(pattern), |
+ ContentSettingsPattern::Wildcard(), type, |
+ PermissionSourceUI::SITE_SETTINGS); |
+ |
settings_map->SetContentSettingCustomScope( |
ContentSettingsPattern::FromString(pattern), |
ContentSettingsPattern::Wildcard(), type, std::string(), setting_type); |