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

Unified Diff: chrome/browser/android/preferences/website_preference_bridge.cc

Issue 2790473004: Permissions: Clear embargo if user changes an embargoed permission's setting. (Closed)
Patch Set: Review comments. Created 3 years, 8 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 | « no previous file | chrome/browser/permissions/permission_decision_auto_blocker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/preferences/website_preference_bridge.cc
diff --git a/chrome/browser/android/preferences/website_preference_bridge.cc b/chrome/browser/android/preferences/website_preference_bridge.cc
index a491d34ade574b9c4d017891e806c77a26119f2e..e8585d993f345a96d854180aca0f7c01d214a8c5 100644
--- a/chrome/browser/android/preferences/website_preference_bridge.cc
+++ b/chrome/browser/android/preferences/website_preference_bridge.cc
@@ -203,6 +203,14 @@ void SetSettingForOrigin(JNIEnv* env,
GURL embedder_url =
embedder ? GURL(ConvertJavaStringToUTF8(env, embedder)) : GURL();
Profile* profile = GetActiveUserProfile(is_incognito);
+
+ // The permission may have been blocked due to being under embargo, so if it
+ // was changed away from BLOCK, clear embargo status if it exists.
+ if (setting != CONTENT_SETTING_BLOCK) {
+ PermissionDecisionAutoBlocker::GetForProfile(profile)->RemoveEmbargoByUrl(
+ origin_url, content_type);
+ }
+
PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter(
profile, origin_url, embedder_url, content_type,
PermissionSourceUI::SITE_SETTINGS);
@@ -331,6 +339,12 @@ static void SetNotificationSettingForOrigin(
Profile* profile = GetActiveUserProfile(is_incognito);
GURL url = GURL(ConvertJavaStringToUTF8(env, origin));
ContentSetting setting = static_cast<ContentSetting>(value);
+
+ if (setting != CONTENT_SETTING_BLOCK) {
+ PermissionDecisionAutoBlocker::GetForProfile(profile)->RemoveEmbargoByUrl(
+ url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
+ }
+
switch (setting) {
case CONTENT_SETTING_DEFAULT:
DesktopNotificationProfileUtil::ClearSetting(profile, url);
« no previous file with comments | « no previous file | chrome/browser/permissions/permission_decision_auto_blocker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698