Index: components/safe_browsing/password_protection/password_protection_service.cc |
diff --git a/components/safe_browsing/password_protection/password_protection_service.cc b/components/safe_browsing/password_protection/password_protection_service.cc |
index 8433e273b9c7ac65cae9bae2943b5d36535ab6f5..18cb74bd37d0bdab449c6fac256d3c428d0c44c1 100644 |
--- a/components/safe_browsing/password_protection/password_protection_service.cc |
+++ b/components/safe_browsing/password_protection/password_protection_service.cc |
@@ -70,6 +70,11 @@ const base::Feature kPasswordFieldOnFocusPinging{ |
const base::Feature kProtectedPasswordEntryPinging{ |
"ProtectedPasswordEntryPinging", base::FEATURE_DISABLED_BY_DEFAULT}; |
+const char kPasswordOnFocusRequestOutcomeHistogramName[] = |
+ "PasswordProtection.RequestOutcome.PasswordFieldOnFocus"; |
+const char kPasswordEntryRequestOutcomeHistogramName[] = |
+ "PasswordProtection.RequestOutcome.ProtectedPasswordEntry"; |
+ |
PasswordProtectionService::PasswordProtectionService( |
const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager, |
scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
@@ -272,13 +277,16 @@ void PasswordProtectionService::StartRequest( |
requests_.insert(std::move(request)); |
} |
-void PasswordProtectionService::MaybeStartLowReputationRequest( |
+void PasswordProtectionService::MaybeStartPasswordFieldOnFocusRequest( |
const GURL& main_frame_url, |
const GURL& password_form_action, |
const GURL& password_form_frame_url) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- if (!IsPingingEnabled(kPasswordFieldOnFocusPinging)) |
+ RequestOutcome request_outcome; |
+ if (!IsPingingEnabled(kPasswordFieldOnFocusPinging, &request_outcome)) { |
+ RecordPingingDisabledReason(kPasswordFieldOnFocusPinging, request_outcome); |
return; |
+ } |
// Skip URLs that we can't get a reliable reputation for. |
if (!main_frame_url.is_valid() || !main_frame_url.SchemeIsHTTPOrHTTPS()) { |
@@ -540,4 +548,22 @@ PasswordProtectionService::CreateDictionaryFromVerdict( |
return result; |
} |
+void PasswordProtectionService::RecordPingingDisabledReason( |
+ const base::Feature& feature, |
+ RequestOutcome reason) { |
+ DCHECK(feature.name == kProtectedPasswordEntryPinging.name || |
+ feature.name == kPasswordFieldOnFocusPinging.name); |
+ |
+ bool is_password_entry_ping = |
+ feature.name == kProtectedPasswordEntryPinging.name; |
+ |
+ if (is_password_entry_ping) { |
+ UMA_HISTOGRAM_ENUMERATION(kPasswordEntryRequestOutcomeHistogramName, reason, |
+ MAX_OUTCOME); |
+ } else { |
+ UMA_HISTOGRAM_ENUMERATION(kPasswordOnFocusRequestOutcomeHistogramName, |
+ reason, MAX_OUTCOME); |
+ } |
+} |
+ |
} // namespace safe_browsing |