| Index: chrome/browser/permissions/permission_util.cc
|
| diff --git a/chrome/browser/permissions/permission_util.cc b/chrome/browser/permissions/permission_util.cc
|
| index 35c087e51c8d7770c113d6faca99f9efe6e67f68..65a38bfbe466456b100b8e6f5488c28891e382a1 100644
|
| --- a/chrome/browser/permissions/permission_util.cc
|
| +++ b/chrome/browser/permissions/permission_util.cc
|
| @@ -85,6 +85,7 @@ PermissionUtil::ScopedRevocationReporter::ScopedRevocationReporter(
|
| ContentSettingsType content_type,
|
| PermissionSourceUI source_ui)
|
| : profile_(profile),
|
| + settings_map_(HostContentSettingsMapFactory::GetForProfile(profile_)),
|
| primary_url_(primary_url),
|
| secondary_url_(secondary_url),
|
| content_type_(content_type),
|
| @@ -94,19 +95,30 @@ PermissionUtil::ScopedRevocationReporter::ScopedRevocationReporter(
|
| is_initially_allowed_ = false;
|
| return;
|
| }
|
| - HostContentSettingsMap* map =
|
| - HostContentSettingsMapFactory::GetForProfile(profile_);
|
| - ContentSetting initial_content_setting = map->GetContentSetting(
|
| + ContentSetting initial_content_setting = settings_map_->GetContentSetting(
|
| primary_url_, secondary_url_, content_type_, std::string());
|
| is_initially_allowed_ = initial_content_setting == CONTENT_SETTING_ALLOW;
|
| }
|
|
|
| +PermissionUtil::ScopedRevocationReporter::ScopedRevocationReporter(
|
| + Profile* profile,
|
| + const ContentSettingsPattern& primary_pattern,
|
| + const ContentSettingsPattern& secondary_pattern,
|
| + ContentSettingsType content_type,
|
| + PermissionSourceUI source_ui)
|
| + : ScopedRevocationReporter(
|
| + profile,
|
| + GURL(primary_pattern.ToString()),
|
| + GURL((secondary_pattern == ContentSettingsPattern::Wildcard())
|
| + ? primary_pattern.ToString()
|
| + : secondary_pattern.ToString()),
|
| + content_type,
|
| + source_ui) {}
|
| +
|
| PermissionUtil::ScopedRevocationReporter::~ScopedRevocationReporter() {
|
| if (!is_initially_allowed_)
|
| return;
|
| - HostContentSettingsMap* map =
|
| - HostContentSettingsMapFactory::GetForProfile(profile_);
|
| - ContentSetting final_content_setting = map->GetContentSetting(
|
| + ContentSetting final_content_setting = settings_map_->GetContentSetting(
|
| primary_url_, secondary_url_, content_type_, std::string());
|
| if (final_content_setting != CONTENT_SETTING_ALLOW) {
|
| PermissionType permission_type;
|
| @@ -116,3 +128,8 @@ PermissionUtil::ScopedRevocationReporter::~ScopedRevocationReporter() {
|
| }
|
| }
|
| }
|
| +
|
| +void PermissionUtil::ScopedRevocationReporter::SetCustomSettingsMap(
|
| + HostContentSettingsMap* settings_map) {
|
| + this->settings_map_ = settings_map;
|
| +}
|
|
|