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

Unified Diff: chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc

Issue 949323002: Collecting UMA metrics for the UnmaskPrompt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving collection to CardUnmaskPromptControllerImpl. Created 5 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/ui/autofill/card_unmask_prompt_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc b/chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc
index abd616f0cb3be6b12478acfb72beb9bfae2360c8..5a2c451a40f878e67b75fe142f95037269f874a8 100644
--- a/chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc
+++ b/chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/autofill/risk_util.h"
#include "chrome/browser/ui/autofill/card_unmask_prompt_view.h"
#include "chrome/grit/generated_resources.h"
+#include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/web_contents.h"
@@ -24,6 +25,9 @@ CardUnmaskPromptControllerImpl::CardUnmaskPromptControllerImpl(
content::WebContents* web_contents)
: web_contents_(web_contents),
card_unmask_view_(nullptr),
+ unmasking_success_(false),
+ unmasking_initial_should_store_pan_(false),
+ unmasking_number_of_attempts_(0),
weak_pointer_factory_(this) {
}
@@ -43,6 +47,10 @@ void CardUnmaskPromptControllerImpl::ShowPrompt(
card_ = card;
delegate_ = delegate;
card_unmask_view_ = CardUnmaskPromptView::CreateAndShow(this);
+ unmasking_success_ = false;
+ unmasking_number_of_attempts_ = 0;
+ unmasking_initial_should_store_pan_ = GetStoreLocallyStartState();
+ AutofillMetrics::LogUnmaskPromptEvent(AutofillMetrics::UNMASK_PROMPT_SHOWN);
}
void CardUnmaskPromptControllerImpl::OnVerificationResult(
@@ -53,8 +61,19 @@ void CardUnmaskPromptControllerImpl::OnVerificationResult(
base::string16 error_message;
bool allow_retry = true;
switch (result) {
- case AutofillClient::SUCCESS:
+ case AutofillClient::SUCCESS: {
+ unmasking_success_ = true;
+ AutofillMetrics::LogUnmaskPromptEvent(
+ AutofillMetrics::UNMASK_PROMPT_UNMASKED_CARD);
+ bool final_should_store_pan =
+ user_prefs::UserPrefs::Get(web_contents_->GetBrowserContext())
+ ->GetBoolean(prefs::kAutofillWalletImportStorageCheckboxState);
+ if (final_should_store_pan) {
+ AutofillMetrics::LogUnmaskPromptEvent(
+ AutofillMetrics::UNMASK_PROMPT_SAVED_CARD_LOCALLY);
+ }
break;
+ }
case AutofillClient::TRY_AGAIN_FAILURE: {
error_message = l10n_util::GetStringUTF16(
@@ -82,6 +101,34 @@ void CardUnmaskPromptControllerImpl::OnVerificationResult(
void CardUnmaskPromptControllerImpl::OnUnmaskDialogClosed() {
card_unmask_view_ = nullptr;
+ if (!unmasking_success_) {
+ if (unmasking_number_of_attempts_ > 0) {
+ AutofillMetrics::LogUnmaskPromptEvent(
+ AutofillMetrics::UNMASK_PROMPT_CLOSED_FAILED_TO_UNMASK);
+ } else {
+ AutofillMetrics::LogUnmaskPromptEvent(
+ AutofillMetrics::UNMASK_PROMPT_CLOSED_NO_ATTEMPTS);
+ }
+ }
+ if (unmasking_number_of_attempts_ > 0) {
+ bool final_should_store_pan =
+ user_prefs::UserPrefs::Get(web_contents_->GetBrowserContext())
+ ->GetBoolean(prefs::kAutofillWalletImportStorageCheckboxState);
+ if (unmasking_initial_should_store_pan_ && final_should_store_pan) {
+ AutofillMetrics::LogUnmaskPromptEvent(
+ AutofillMetrics::UNMASK_PROMPT_LOCAL_SAVE_KEPT_OPT_IN);
+ } else if (!unmasking_initial_should_store_pan_
+ && !final_should_store_pan) {
+ AutofillMetrics::LogUnmaskPromptEvent(
+ AutofillMetrics::UNMASK_PROMPT_LOCAL_SAVE_KEPT_OPT_OUT);
+ } else if (unmasking_initial_should_store_pan_ && !final_should_store_pan) {
+ AutofillMetrics::LogUnmaskPromptEvent(
+ AutofillMetrics::UNMASK_PROMPT_LOCAL_SAVE_DID_OPT_OUT);
+ } else {
+ AutofillMetrics::LogUnmaskPromptEvent(
+ AutofillMetrics::UNMASK_PROMPT_LOCAL_SAVE_DID_OPT_IN);
+ }
+ }
delegate_->OnUnmaskPromptClosed();
}
@@ -90,6 +137,7 @@ void CardUnmaskPromptControllerImpl::OnUnmaskResponse(
const base::string16& exp_month,
const base::string16& exp_year,
bool should_store_pan) {
+ unmasking_number_of_attempts_++;
card_unmask_view_->DisableAndWaitForVerification();
DCHECK(!cvc.empty());

Powered by Google App Engine
This is Rietveld 408576698