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

Unified Diff: chrome/browser/ui/page_info/page_info.cc

Issue 2790473004: Permissions: Clear embargo if user changes an embargoed permission's setting. (Closed)
Patch Set: Created 3 years, 9 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
Index: chrome/browser/ui/page_info/page_info.cc
diff --git a/chrome/browser/ui/page_info/page_info.cc b/chrome/browser/ui/page_info/page_info.cc
index d45117acce88cb60a7323d0ef9c2624e99fc6028..1a062389b1dc40dc406add438837022555b4d0e3 100644
--- a/chrome/browser/ui/page_info/page_info.cc
+++ b/chrome/browser/ui/page_info/page_info.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/permissions/chooser_context_base.h"
+#include "chrome/browser/permissions/permission_decision_auto_blocker.h"
#include "chrome/browser/permissions/permission_manager.h"
#include "chrome/browser/permissions/permission_result.h"
#include "chrome/browser/permissions/permission_uma_util.h"
@@ -306,6 +307,22 @@ void PageInfo::OnSitePermissionChanged(ContentSettingsType type,
this->profile_, this->site_url_, this->site_url_, type,
dominickn 2017/04/03 01:35:31 Nit: the this-> usage here and below is weird (onl
Patti Lor 2017/04/05 08:34:27 Sorry, I thought for some reason there was a reaso
PermissionSourceUI::OIB);
+ // If the setting was changed away from an embargo status (which will always
+ // be BLOCK), clear the embargo.
+ if (setting != CONTENT_SETTING_BLOCK && PermissionUtil::IsPermission(type)) {
+ PermissionResult permission_result =
+ PermissionManager::Get(profile_)->GetPermissionStatus(
+ type, this->site_url_, this->site_url_);
+ switch (permission_result.source) {
+ case PermissionStatusSource::MULTIPLE_DISMISSALS:
+ case PermissionStatusSource::SAFE_BROWSING_BLACKLIST:
+ PermissionDecisionAutoBlocker::GetForProfile(profile_)
+ ->RemoveEmbargoByURL(this->site_url_, type);
+ break;
+ default:
+ break;
+ }
+ }
content_settings_->SetNarrowestContentSetting(site_url_, site_url_, type,
setting);

Powered by Google App Engine
This is Rietveld 408576698