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

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

Issue 2690543004: Add UMA for recording embargo reasons and autoblocker interactions. (Closed)
Patch Set: Address comment Created 3 years, 10 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_context_base_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c00f3e7aa503570ad94c778a64b0b4923857aa9d..895589edcae1fc8bac7c79eaadb618b988bcb103 100644
--- a/chrome/browser/permissions/permission_context_base.cc
+++ b/chrome/browser/permissions/permission_context_base.cc
@@ -146,13 +146,14 @@ void PermissionContextBase::ContinueRequestPermission(
bool permission_blocked) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (permission_blocked) {
- // TODO(meredithl): Add UMA metrics here.
web_contents->GetMainFrame()->AddMessageToConsole(
content::CONSOLE_MESSAGE_LEVEL_INFO,
base::StringPrintf(
"%s permission has been auto-blocked.",
PermissionUtil::GetPermissionString(permission_type_).c_str()));
// Permission has been automatically blocked.
+ PermissionUmaUtil::RecordPermissionEmbargoStatus(
+ PermissionEmbargoStatus::PERMISSIONS_BLACKLISTING);
callback.Run(CONTENT_SETTING_BLOCK);
return;
}
@@ -295,6 +296,8 @@ void PermissionContextBase::PermissionDecided(
PermissionRequestGestureType gesture_type =
user_gesture ? PermissionRequestGestureType::GESTURE
: PermissionRequestGestureType::NO_GESTURE;
+ PermissionEmbargoStatus embargo_status =
+ PermissionEmbargoStatus::NOT_EMBARGOED;
DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
content_setting == CONTENT_SETTING_BLOCK ||
content_setting == CONTENT_SETTING_DEFAULT);
@@ -307,15 +310,13 @@ void PermissionContextBase::PermissionDecided(
} else {
PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type,
requesting_origin, profile_);
- }
- }
- if (content_setting == CONTENT_SETTING_DEFAULT &&
- PermissionDecisionAutoBlocker::GetForProfile(profile_)
- ->RecordDismissAndEmbargo(requesting_origin, permission_type_)) {
- // The permission has been embargoed, so it is blocked for this permission
- // request, but not persisted.
- content_setting = CONTENT_SETTING_BLOCK;
+ if (PermissionDecisionAutoBlocker::GetForProfile(profile_)
+ ->RecordDismissAndEmbargo(requesting_origin, permission_type_)) {
+ embargo_status = PermissionEmbargoStatus::REPEATED_DISMISSALS;
+ }
+ }
+ PermissionUmaUtil::RecordPermissionEmbargoStatus(embargo_status);
}
NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
« no previous file with comments | « no previous file | chrome/browser/permissions/permission_context_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698