| Index: chrome/browser/media/protected_media_identifier_permission_context.cc
|
| diff --git a/chrome/browser/media/protected_media_identifier_permission_context.cc b/chrome/browser/media/protected_media_identifier_permission_context.cc
|
| index 50c2dc51ec53a1f4269eff81c038c44fc6eb40bc..d558d88c2ef5b84bdee51d222f69ea47740225c8 100644
|
| --- a/chrome/browser/media/protected_media_identifier_permission_context.cc
|
| +++ b/chrome/browser/media/protected_media_identifier_permission_context.cc
|
| @@ -18,6 +18,7 @@
|
| #if defined(OS_CHROMEOS)
|
| #include <utility>
|
|
|
| +#include "base/metrics/histogram_macros.h"
|
| #include "chrome/browser/chromeos/attestation/platform_verification_dialog.h"
|
| #include "chrome/browser/chromeos/settings/cros_settings.h"
|
| #include "chromeos/chromeos_switches.h"
|
| @@ -186,6 +187,12 @@ bool ProtectedMediaIdentifierPermissionContext::
|
| }
|
|
|
| #if defined(OS_CHROMEOS)
|
| +
|
| +static void ReportPermissionActionUMA(PermissionAction action) {
|
| + UMA_HISTOGRAM_ENUMERATION("Permissions.Action.ProtectedMedia", action,
|
| + PermissionAction::NUM);
|
| +}
|
| +
|
| void ProtectedMediaIdentifierPermissionContext::
|
| OnPlatformVerificationConsentResponse(
|
| content::WebContents* web_contents,
|
| @@ -195,9 +202,13 @@ void ProtectedMediaIdentifierPermissionContext::
|
| const BrowserPermissionCallback& callback,
|
| PlatformVerificationDialog::ConsentResponse response) {
|
| // The request may have been canceled. Drop the callback in that case.
|
| + // This can happen if the tab is closed.
|
| PendingRequestMap::iterator request = pending_requests_.find(web_contents);
|
| - if (request == pending_requests_.end())
|
| + if (request == pending_requests_.end()) {
|
| + VLOG(1) << "Platform verification ignored by user.";
|
| + ReportPermissionActionUMA(PermissionAction::IGNORED);
|
| return;
|
| + }
|
|
|
| DCHECK(request->second.second == id);
|
| pending_requests_.erase(request);
|
| @@ -206,7 +217,10 @@ void ProtectedMediaIdentifierPermissionContext::
|
| bool persist = false; // Whether the ContentSetting should be saved.
|
| switch (response) {
|
| case PlatformVerificationDialog::CONSENT_RESPONSE_NONE:
|
| + // This can happen if user clicked "x", or pressed "Esc", or navigated
|
| + // away without closing the tab.
|
| VLOG(1) << "Platform verification dismissed by user.";
|
| + ReportPermissionActionUMA(PermissionAction::DISMISSED);
|
| content_setting = CONTENT_SETTING_ASK;
|
| persist = false;
|
| break;
|
| @@ -214,6 +228,7 @@ void ProtectedMediaIdentifierPermissionContext::
|
| VLOG(1) << "Platform verification accepted by user.";
|
| base::RecordAction(
|
| base::UserMetricsAction("PlatformVerificationAccepted"));
|
| + ReportPermissionActionUMA(PermissionAction::GRANTED);
|
| content_setting = CONTENT_SETTING_ALLOW;
|
| persist = true;
|
| break;
|
| @@ -221,6 +236,7 @@ void ProtectedMediaIdentifierPermissionContext::
|
| VLOG(1) << "Platform verification denied by user.";
|
| base::RecordAction(
|
| base::UserMetricsAction("PlatformVerificationRejected"));
|
| + ReportPermissionActionUMA(PermissionAction::DENIED);
|
| content_setting = CONTENT_SETTING_BLOCK;
|
| persist = true;
|
| break;
|
|
|