Chromium Code Reviews| 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..4ebb2d676a35b14c4a1e3640678d242002f9c67f 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::RecordPermissionEmbargoReason( |
| + PermissionEmbargoReason::BLACKLISTED); |
| callback.Run(CONTENT_SETTING_BLOCK); |
| return; |
| } |
| @@ -301,21 +302,31 @@ void PermissionContextBase::PermissionDecided( |
| if (content_setting == CONTENT_SETTING_ALLOW) { |
| PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type, |
| requesting_origin, profile_); |
| + PermissionUmaUtil::RecordPermissionEmbargoReason( |
| + PermissionEmbargoReason::NOT_EMBARGOED); |
| } else if (content_setting == CONTENT_SETTING_BLOCK) { |
| PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, |
| requesting_origin, profile_); |
| + PermissionUmaUtil::RecordPermissionEmbargoReason( |
| + PermissionEmbargoReason::NOT_EMBARGOED); |
| } 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 (content_setting == CONTENT_SETTING_DEFAULT) { |
|
raymes
2017/02/08 23:20:09
Can we move the contents of this if-block into the
meredithl
2017/02/09 00:15:36
Done.
|
| + if (PermissionDecisionAutoBlocker::GetForProfile(profile_) |
| + ->RecordDismissAndEmbargo(requesting_origin, permission_type_)) { |
| + // The permission has been embargoed, so it is blocked for this permission |
| + // request, but not persisted. |
| + PermissionUmaUtil::RecordPermissionEmbargoReason( |
| + PermissionEmbargoReason::REPEATED_DISMISSALS); |
| + content_setting = CONTENT_SETTING_BLOCK; |
|
raymes
2017/02/08 23:20:09
nit: Can we actually remove this line? I think the
meredithl
2017/02/09 00:15:37
Done. I had to change the test logic slightly to e
|
| + } else { |
| + PermissionUmaUtil::RecordPermissionEmbargoReason( |
| + PermissionEmbargoReason::NOT_EMBARGOED); |
| + } |
| } |
| NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |