Chromium Code Reviews| Index: components/autofill/core/browser/autofill_manager.cc |
| diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc |
| index 4aa8554fa316e26b4589543c47778820b3c1d27b..6ec08c8867a6a26caecc810cf29f731873c92cdc 100644 |
| --- a/components/autofill/core/browser/autofill_manager.cc |
| +++ b/components/autofill/core/browser/autofill_manager.cc |
| @@ -1322,16 +1322,21 @@ int AutofillManager::GetProfilesForCreditCardUpload( |
| const base::Time now = AutofillClock::Now(); |
| const base::TimeDelta fifteen_minutes = base::TimeDelta::FromMinutes(15); |
| int upload_decision_metrics = 0; |
| + bool has_profile = false; |
| // First, collect all of the addresses used recently. |
| for (AutofillProfile* profile : personal_data_->GetProfiles()) { |
| + has_profile = true; |
| if ((now - profile->use_date()) < fifteen_minutes || |
| (now - profile->modification_date()) < fifteen_minutes) { |
| candidate_profiles.push_back(*profile); |
| } |
| } |
| if (candidate_profiles.empty()) { |
| - upload_decision_metrics |= AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ADDRESS; |
| + upload_decision_metrics |= |
| + has_profile |
| + ? AutofillMetrics::UPLOAD_NOT_OFFERED_NO_RECENTLY_USED_ADDRESS |
| + : AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ADDRESS; |
|
Jared Saul
2017/05/05 22:17:50
nit: Could we change this to reflect it's new clea
csashi
2017/05/05 22:42:26
Done.
|
| *rappor_metric_name = "Autofill.CardUploadNotOfferedNoAddress"; |
| } |
| @@ -1407,7 +1412,7 @@ int AutofillManager::GetProfilesForCreditCardUpload( |
| // If none of the candidate addresses have a zip, the candidate set is |
| // invalid. |
| - if (verified_zip.empty()) |
| + if (verified_zip.empty() && !candidate_profiles.empty()) |
| upload_decision_metrics |= AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE; |
| if (!upload_decision_metrics) |