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 49f488c2482f3962dc2a649f6eb19cdda79977c6..a21eabe8a96650e119eeaf76aeabb1c006da9e76 100644 |
--- a/components/autofill/core/browser/autofill_manager.cc |
+++ b/components/autofill/core/browser/autofill_manager.cc |
@@ -23,6 +23,7 @@ |
#include "base/logging.h" |
#include "base/memory/ptr_util.h" |
#include "base/message_loop/message_loop.h" |
+#include "base/metrics/histogram_macros.h" |
#include "base/path_service.h" |
#include "base/strings/string16.h" |
#include "base/strings/string_number_conversions.h" |
@@ -1298,15 +1299,19 @@ int AutofillManager::GetProfilesForCreditCardUpload( |
const base::TimeDelta fifteen_minutes = base::TimeDelta::FromMinutes(15); |
int upload_decision_metrics = 0; |
bool has_profile = false; |
+ bool has_modified_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) { |
+ if ((now - profile->modification_date()) < fifteen_minutes) { |
+ has_modified_profile = true; |
+ candidate_profiles.push_back(*profile); |
+ } else if ((now - profile->use_date()) < fifteen_minutes) { |
candidate_profiles.push_back(*profile); |
} |
} |
+ |
if (candidate_profiles.empty()) { |
upload_decision_metrics |= |
has_profile |
@@ -1389,9 +1394,14 @@ int AutofillManager::GetProfilesForCreditCardUpload( |
if (verified_zip.empty() && !candidate_profiles.empty()) |
upload_decision_metrics |= AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE; |
- if (!upload_decision_metrics) |
+ if (!upload_decision_metrics) { |
profiles->assign(candidate_profiles.begin(), candidate_profiles.end()); |
- |
+ if (!has_modified_profile) |
+ for (const AutofillProfile& profile : candidate_profiles) |
+ UMA_HISTOGRAM_COUNTS_1000( |
+ "Autofill.DaysSincePreviousUseAtSubmission.Profile", |
+ (profile.use_date() - profile.previous_use_date()).InDays()); |
+ } |
return upload_decision_metrics; |
} |