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

Unified Diff: chrome/browser/permissions/permission_context_base.cc

Issue 2790493002: Implement permissions embargo for prompts which are repeatedly ignored. (Closed)
Patch Set: Not for plugins 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/permissions/permission_context_base.cc
diff --git a/chrome/browser/permissions/permission_context_base.cc b/chrome/browser/permissions/permission_context_base.cc
index 93c1b112d12f7aeb657eab3537b385d1f2477832..776322302c31e92852741a3b92d17d648e41a30b 100644
--- a/chrome/browser/permissions/permission_context_base.cc
+++ b/chrome/browser/permissions/permission_context_base.cc
@@ -53,6 +53,12 @@ const char kPermissionBlockedRepeatedDismissalsMessage[] =
"https://www.chromestatus.com/features/6443143280984064 for more "
"information.";
+const char kPermissionBlockedRepeatedIgnoresMessage[] =
+ "%s permission has been blocked as the user has ignored the permission "
+ "prompt several times. See "
+ "https://www.chromestatus.com/features/6443143280984064 for more "
+ "information.";
+
const char kPermissionBlockedBlacklistMessage[] =
"this origin is not allowed to request %s permission.";
@@ -124,17 +130,31 @@ void PermissionContextBase::RequestPermission(
if (result.content_setting == CONTENT_SETTING_ALLOW ||
result.content_setting == CONTENT_SETTING_BLOCK) {
- if (result.source == PermissionStatusSource::KILL_SWITCH) {
- // Block the request and log to the developer console.
- LogPermissionBlockedMessage(web_contents,
- kPermissionBlockedKillSwitchMessage,
- content_settings_type_);
- callback.Run(CONTENT_SETTING_BLOCK);
- return;
- } else if (result.source == PermissionStatusSource::MULTIPLE_DISMISSALS) {
- LogPermissionBlockedMessage(web_contents,
- kPermissionBlockedRepeatedDismissalsMessage,
- content_settings_type_);
+ switch (result.source) {
+ case PermissionStatusSource::KILL_SWITCH:
+ // Block the request and log to the developer console.
+ LogPermissionBlockedMessage(web_contents,
+ kPermissionBlockedKillSwitchMessage,
+ content_settings_type_);
+ callback.Run(CONTENT_SETTING_BLOCK);
+ return;
+ case PermissionStatusSource::MULTIPLE_DISMISSALS:
+ LogPermissionBlockedMessage(web_contents,
+ kPermissionBlockedRepeatedDismissalsMessage,
+ content_settings_type_);
+ break;
+ case PermissionStatusSource::MULTIPLE_IGNORES:
+ LogPermissionBlockedMessage(web_contents,
+ kPermissionBlockedRepeatedIgnoresMessage,
+ content_settings_type_);
+ break;
+ case PermissionStatusSource::SAFE_BROWSING_BLACKLIST:
+ LogPermissionBlockedMessage(web_contents,
+ kPermissionBlockedBlacklistMessage,
+ content_settings_type_);
+ break;
+ case PermissionStatusSource::UNSPECIFIED:
+ break;
}
// If we are under embargo, record the embargo reason for which we have

Powered by Google App Engine
This is Rietveld 408576698