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

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: review comments 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..b40e5c93a33eeca9f65eeb3fce36596aa0a65908 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,10 @@ 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),
+ unmasking_allow_retry_(true),
weak_pointer_factory_(this) {
}
@@ -32,6 +37,10 @@ CardUnmaskPromptControllerImpl::~CardUnmaskPromptControllerImpl() {
card_unmask_view_->ControllerGone();
}
+CardUnmaskPromptView* CardUnmaskPromptControllerImpl::CreateAndShowView() {
+ return CardUnmaskPromptView::CreateAndShow(this);
+}
+
void CardUnmaskPromptControllerImpl::ShowPrompt(
const CreditCard& card,
base::WeakPtr<CardUnmaskDelegate> delegate) {
@@ -42,7 +51,12 @@ void CardUnmaskPromptControllerImpl::ShowPrompt(
LoadRiskFingerprint();
card_ = card;
delegate_ = delegate;
- card_unmask_view_ = CardUnmaskPromptView::CreateAndShow(this);
+ card_unmask_view_ = CreateAndShowView();
+ unmasking_success_ = false;
+ unmasking_number_of_attempts_ = 0;
+ unmasking_initial_should_store_pan_ = GetStoreLocallyStartState();
+ unmasking_allow_retry_ = true;
+ AutofillMetrics::LogUnmaskPromptEvent(AutofillMetrics::UNMASK_PROMPT_SHOWN);
}
void CardUnmaskPromptControllerImpl::OnVerificationResult(
@@ -53,8 +67,21 @@ void CardUnmaskPromptControllerImpl::OnVerificationResult(
base::string16 error_message;
bool allow_retry = true;
switch (result) {
- case AutofillClient::SUCCESS:
+ case AutofillClient::SUCCESS: {
+ unmasking_success_ = true;
+ AutofillMetrics::LogUnmaskPromptEvent(
+ unmasking_number_of_attempts_ == 1
+ ? AutofillMetrics::UNMASK_PROMPT_UNMASKED_CARD_FIRST_ATTEMPT
+ : AutofillMetrics::UNMASK_PROMPT_UNMASKED_CARD_AFTER_FAILED_ATTEMPTS);
+ 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(
@@ -77,11 +104,42 @@ void CardUnmaskPromptControllerImpl::OnVerificationResult(
}
}
+ unmasking_allow_retry_ = allow_retry;
card_unmask_view_->GotVerificationResult(error_message, allow_retry);
}
void CardUnmaskPromptControllerImpl::OnUnmaskDialogClosed() {
card_unmask_view_ = nullptr;
+ if (!unmasking_success_) {
+ AutofillMetrics::UnmaskPromptEvent event;
+ if (unmasking_number_of_attempts_ == 0) {
+ event = AutofillMetrics::UNMASK_PROMPT_CLOSED_NO_ATTEMPTS;
+ } else if (unmasking_allow_retry_) {
+ event = AutofillMetrics
+ ::UNMASK_PROMPT_CLOSED_FAILED_TO_UNMASK_RETRIABLE_FAILURE;
Evan Stade 2015/03/18 21:29:07 on further reflection, we should perhaps log exact
Walter Cacau 2015/03/18 23:50:05 Done.
+ } else {
+ event = AutofillMetrics
+ ::UNMASK_PROMPT_CLOSED_FAILED_TO_UNMASK_NON_RETRIABLE_FAILURE;
+ }
+ AutofillMetrics::LogUnmaskPromptEvent(event);
+ }
+ if (unmasking_number_of_attempts_ > 0) {
+ bool final_should_store_pan =
+ user_prefs::UserPrefs::Get(web_contents_->GetBrowserContext())
+ ->GetBoolean(prefs::kAutofillWalletImportStorageCheckboxState);
+ AutofillMetrics::UnmaskPromptEvent event;
+ if (unmasking_initial_should_store_pan_ && final_should_store_pan) {
+ event = AutofillMetrics::UNMASK_PROMPT_LOCAL_SAVE_DID_NOT_OPT_OUT;
+ } else if (!unmasking_initial_should_store_pan_
+ && !final_should_store_pan) {
+ event = AutofillMetrics::UNMASK_PROMPT_LOCAL_SAVE_DID_NOT_OPT_IN;
+ } else if (unmasking_initial_should_store_pan_ && !final_should_store_pan) {
+ event = AutofillMetrics::UNMASK_PROMPT_LOCAL_SAVE_DID_OPT_OUT;
+ } else {
+ event = AutofillMetrics::UNMASK_PROMPT_LOCAL_SAVE_DID_OPT_IN;
+ }
+ AutofillMetrics::LogUnmaskPromptEvent(event);
+ }
delegate_->OnUnmaskPromptClosed();
}
@@ -90,6 +148,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