OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/autofill/core/browser/autofill_manager.h" | 5 #include "components/autofill/core/browser/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 | 1314 |
1315 int AutofillManager::GetProfilesForCreditCardUpload( | 1315 int AutofillManager::GetProfilesForCreditCardUpload( |
1316 const CreditCard& card, | 1316 const CreditCard& card, |
1317 std::vector<AutofillProfile>* profiles, | 1317 std::vector<AutofillProfile>* profiles, |
1318 std::string* rappor_metric_name) const { | 1318 std::string* rappor_metric_name) const { |
1319 std::vector<AutofillProfile> candidate_profiles; | 1319 std::vector<AutofillProfile> candidate_profiles; |
1320 const base::Time now = AutofillClock::Now(); | 1320 const base::Time now = AutofillClock::Now(); |
1321 const base::TimeDelta fifteen_minutes = base::TimeDelta::FromMinutes(15); | 1321 const base::TimeDelta fifteen_minutes = base::TimeDelta::FromMinutes(15); |
1322 int upload_decision_metrics = 0; | 1322 int upload_decision_metrics = 0; |
1323 bool has_profile = false; | 1323 bool has_profile = false; |
| 1324 bool has_modified_profile = false; |
1324 | 1325 |
1325 // First, collect all of the addresses used recently. | 1326 // First, collect all of the addresses used or modified recently. |
1326 for (AutofillProfile* profile : personal_data_->GetProfiles()) { | 1327 for (AutofillProfile* profile : personal_data_->GetProfiles()) { |
1327 has_profile = true; | 1328 has_profile = true; |
1328 if ((now - profile->use_date()) < fifteen_minutes || | 1329 if ((now - profile->modification_date()) < fifteen_minutes) { |
1329 (now - profile->modification_date()) < fifteen_minutes) { | 1330 has_modified_profile = true; |
| 1331 candidate_profiles.push_back(*profile); |
| 1332 } else if ((now - profile->use_date()) < fifteen_minutes) { |
1330 candidate_profiles.push_back(*profile); | 1333 candidate_profiles.push_back(*profile); |
1331 } | 1334 } |
1332 } | 1335 } |
| 1336 |
| 1337 AutofillMetrics::LogHasModifiedProfileOnCreditCardFormSubmission( |
| 1338 has_modified_profile); |
| 1339 |
1333 if (candidate_profiles.empty()) { | 1340 if (candidate_profiles.empty()) { |
1334 upload_decision_metrics |= | 1341 upload_decision_metrics |= |
1335 has_profile | 1342 has_profile |
1336 ? AutofillMetrics::UPLOAD_NOT_OFFERED_NO_RECENTLY_USED_ADDRESS | 1343 ? AutofillMetrics::UPLOAD_NOT_OFFERED_NO_RECENTLY_USED_ADDRESS |
1337 : AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ADDRESS_PROFILE; | 1344 : AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ADDRESS_PROFILE; |
1338 *rappor_metric_name = "Autofill.CardUploadNotOfferedNoAddress"; | 1345 *rappor_metric_name = "Autofill.CardUploadNotOfferedNoAddress"; |
1339 } | 1346 } |
1340 | 1347 |
1341 // If any of the names on the card or the addresses don't match the | 1348 // If any of the names on the card or the addresses don't match the |
1342 // candidate set is invalid. This matches the rules for name matching applied | 1349 // candidate set is invalid. This matches the rules for name matching applied |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2294 #endif // ENABLE_FORM_DEBUG_DUMP | 2301 #endif // ENABLE_FORM_DEBUG_DUMP |
2295 | 2302 |
2296 void AutofillManager::LogCardUploadDecisions(int upload_decision_metrics) { | 2303 void AutofillManager::LogCardUploadDecisions(int upload_decision_metrics) { |
2297 AutofillMetrics::LogCardUploadDecisionMetrics(upload_decision_metrics); | 2304 AutofillMetrics::LogCardUploadDecisionMetrics(upload_decision_metrics); |
2298 AutofillMetrics::LogCardUploadDecisionsUkm(client_->GetUkmService(), | 2305 AutofillMetrics::LogCardUploadDecisionsUkm(client_->GetUkmService(), |
2299 pending_upload_request_url_, | 2306 pending_upload_request_url_, |
2300 upload_decision_metrics); | 2307 upload_decision_metrics); |
2301 } | 2308 } |
2302 | 2309 |
2303 } // namespace autofill | 2310 } // namespace autofill |
OLD | NEW |