Chromium Code Reviews| 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 24 matching lines...) Expand all Loading... | |
| 35 #include "build/build_config.h" | 35 #include "build/build_config.h" |
| 36 #include "components/autofill/core/browser/autocomplete_history_manager.h" | 36 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
| 37 #include "components/autofill/core/browser/autofill_client.h" | 37 #include "components/autofill/core/browser/autofill_client.h" |
| 38 #include "components/autofill/core/browser/autofill_data_model.h" | 38 #include "components/autofill/core/browser/autofill_data_model.h" |
| 39 #include "components/autofill/core/browser/autofill_experiments.h" | 39 #include "components/autofill/core/browser/autofill_experiments.h" |
| 40 #include "components/autofill/core/browser/autofill_external_delegate.h" | 40 #include "components/autofill/core/browser/autofill_external_delegate.h" |
| 41 #include "components/autofill/core/browser/autofill_field.h" | 41 #include "components/autofill/core/browser/autofill_field.h" |
| 42 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" | 42 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" |
| 43 #include "components/autofill/core/browser/autofill_metrics.h" | 43 #include "components/autofill/core/browser/autofill_metrics.h" |
| 44 #include "components/autofill/core/browser/autofill_profile.h" | 44 #include "components/autofill/core/browser/autofill_profile.h" |
| 45 #include "components/autofill/core/browser/autofill_profile_comparator.h" | |
| 45 #include "components/autofill/core/browser/autofill_type.h" | 46 #include "components/autofill/core/browser/autofill_type.h" |
| 46 #include "components/autofill/core/browser/country_names.h" | 47 #include "components/autofill/core/browser/country_names.h" |
| 47 #include "components/autofill/core/browser/credit_card.h" | 48 #include "components/autofill/core/browser/credit_card.h" |
| 48 #include "components/autofill/core/browser/field_types.h" | 49 #include "components/autofill/core/browser/field_types.h" |
| 49 #include "components/autofill/core/browser/form_structure.h" | 50 #include "components/autofill/core/browser/form_structure.h" |
| 50 #include "components/autofill/core/browser/personal_data_manager.h" | 51 #include "components/autofill/core/browser/personal_data_manager.h" |
| 51 #include "components/autofill/core/browser/phone_number.h" | 52 #include "components/autofill/core/browser/phone_number.h" |
| 52 #include "components/autofill/core/browser/phone_number_i18n.h" | 53 #include "components/autofill/core/browser/phone_number_i18n.h" |
| 53 #include "components/autofill/core/browser/popup_item_ids.h" | 54 #include "components/autofill/core/browser/popup_item_ids.h" |
| 54 #include "components/autofill/core/browser/ui/save_card_bubble_controller.h" | 55 #include "components/autofill/core/browser/ui/save_card_bubble_controller.h" |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1048 upload_request_.card, std::move(legal_message), | 1049 upload_request_.card, std::move(legal_message), |
| 1049 should_cvc_be_requested_, | 1050 should_cvc_be_requested_, |
| 1050 base::Bind(&AutofillManager::OnUserDidAcceptUpload, | 1051 base::Bind(&AutofillManager::OnUserDidAcceptUpload, |
| 1051 weak_ptr_factory_.GetWeakPtr())); | 1052 weak_ptr_factory_.GetWeakPtr())); |
| 1052 client_->LoadRiskData(base::Bind(&AutofillManager::OnDidGetUploadRiskData, | 1053 client_->LoadRiskData(base::Bind(&AutofillManager::OnDidGetUploadRiskData, |
| 1053 weak_ptr_factory_.GetWeakPtr())); | 1054 weak_ptr_factory_.GetWeakPtr())); |
| 1054 AutofillMetrics::CardUploadDecisionMetric card_upload_decision_metric = | 1055 AutofillMetrics::CardUploadDecisionMetric card_upload_decision_metric = |
| 1055 should_cvc_be_requested_ ? AutofillMetrics::UPLOAD_OFFERED_NO_CVC | 1056 should_cvc_be_requested_ ? AutofillMetrics::UPLOAD_OFFERED_NO_CVC |
| 1056 : AutofillMetrics::UPLOAD_OFFERED; | 1057 : AutofillMetrics::UPLOAD_OFFERED; |
| 1057 AutofillMetrics::LogCardUploadDecisionMetric(card_upload_decision_metric); | 1058 AutofillMetrics::LogCardUploadDecisionMetric(card_upload_decision_metric); |
| 1058 LogCardUploadDecisionUkm(card_upload_decision_metric); | 1059 LogCardUploadDecisionsUkm({card_upload_decision_metric}); |
| 1059 } else { | 1060 } else { |
| 1060 // If the upload details request failed, fall back to a local save. The | 1061 // If the upload details request failed, fall back to a local save. The |
| 1061 // reasoning here is as follows: | 1062 // reasoning here is as follows: |
| 1062 // - This will sometimes fail intermittently, in which case it might be | 1063 // - This will sometimes fail intermittently, in which case it might be |
| 1063 // better to not fall back, because sometimes offering upload and sometimes | 1064 // better to not fall back, because sometimes offering upload and sometimes |
| 1064 // offering local save is a poor user experience. | 1065 // offering local save is a poor user experience. |
| 1065 // - However, in some cases, our local configuration limiting the feature to | 1066 // - However, in some cases, our local configuration limiting the feature to |
| 1066 // countries that Payments is known to support will not match Payments' own | 1067 // countries that Payments is known to support will not match Payments' own |
| 1067 // determination of what country the user is located in. In these cases, | 1068 // determination of what country the user is located in. In these cases, |
| 1068 // the upload details request will consistently fail and if we don't fall | 1069 // the upload details request will consistently fail and if we don't fall |
| 1069 // back to a local save then the user will never be offered any kind of | 1070 // back to a local save then the user will never be offered any kind of |
| 1070 // credit card save. | 1071 // credit card save. |
| 1071 client_->ConfirmSaveCreditCardLocally( | 1072 client_->ConfirmSaveCreditCardLocally( |
| 1072 upload_request_.card, | 1073 upload_request_.card, |
| 1073 base::Bind( | 1074 base::Bind( |
| 1074 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard), | 1075 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard), |
| 1075 base::Unretained(personal_data_), upload_request_.card)); | 1076 base::Unretained(personal_data_), upload_request_.card)); |
| 1076 AutofillMetrics::LogCardUploadDecisionMetric( | 1077 AutofillMetrics::LogCardUploadDecisionMetric( |
| 1077 AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED); | 1078 AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED); |
| 1078 LogCardUploadDecisionUkm( | 1079 LogCardUploadDecisionsUkm( |
| 1079 AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED); | 1080 {AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED}); |
| 1080 } | 1081 } |
| 1081 pending_upload_request_url_ = GURL(); | 1082 pending_upload_request_url_ = GURL(); |
| 1082 } | 1083 } |
| 1083 | 1084 |
| 1084 void AutofillManager::OnDidUploadCard(AutofillClient::PaymentsRpcResult result, | 1085 void AutofillManager::OnDidUploadCard(AutofillClient::PaymentsRpcResult result, |
| 1085 const std::string& server_id) { | 1086 const std::string& server_id) { |
| 1086 // We don't do anything user-visible if the upload attempt fails. | 1087 // We don't do anything user-visible if the upload attempt fails. |
| 1087 // If the upload succeeds, we will keep a copy of the card as a full server | 1088 // If the upload succeeds, we will keep a copy of the card as a full server |
| 1088 // card on the device. | 1089 // card on the device. |
| 1089 if (result == AutofillClient::SUCCESS && !server_id.empty()) { | 1090 if (result == AutofillClient::SUCCESS && !server_id.empty()) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1247 if (field->Type().GetStorableType() == CREDIT_CARD_VERIFICATION_CODE && | 1248 if (field->Type().GetStorableType() == CREDIT_CARD_VERIFICATION_CODE && |
| 1248 IsValidCreditCardSecurityCode(field->value, | 1249 IsValidCreditCardSecurityCode(field->value, |
| 1249 upload_request_.card.type())) { | 1250 upload_request_.card.type())) { |
| 1250 upload_request_.cvc = field->value; | 1251 upload_request_.cvc = field->value; |
| 1251 break; | 1252 break; |
| 1252 } | 1253 } |
| 1253 } | 1254 } |
| 1254 | 1255 |
| 1255 // Upload requires that recently used or modified addresses meet the | 1256 // Upload requires that recently used or modified addresses meet the |
| 1256 // client-side validation rules. | 1257 // client-side validation rules. |
| 1257 autofill::AutofillMetrics::CardUploadDecisionMetric | 1258 std::vector<AutofillMetrics::CardUploadDecisionMetric> |
| 1258 get_profiles_decision_metric = AutofillMetrics::UPLOAD_OFFERED; | 1259 upload_decision_metrics; |
| 1259 std::string rappor_metric_name; | 1260 std::string rappor_metric_name; |
| 1260 bool get_profiles_succeeded = | 1261 bool get_profiles_succeeded = GetProfilesForCreditCardUpload( |
|
Jared Saul
2017/04/28 19:21:42
Is this new formatting the result of a tool? It's
csashi
2017/04/28 23:47:45
I am using git cl format, which is the tool recomm
| |
| 1261 GetProfilesForCreditCardUpload(*imported_credit_card, | 1262 *imported_credit_card, &upload_request_.profiles, |
| 1262 &upload_request_.profiles, | 1263 &upload_decision_metrics, &rappor_metric_name); |
| 1263 &get_profiles_decision_metric, | 1264 DCHECK_EQ(get_profiles_succeeded, upload_decision_metrics.empty()); |
| 1264 &rappor_metric_name); | |
| 1265 | 1265 |
| 1266 pending_upload_request_url_ = GURL(submitted_form.source_url()); | 1266 pending_upload_request_url_ = GURL(submitted_form.source_url()); |
| 1267 | 1267 |
| 1268 // Both the CVC and address checks are done. Conform to the legacy order of | 1268 // Both the CVC and address checks are done. Conform to the legacy order of |
| 1269 // reporting on CVC then address. | 1269 // reporting on CVC then address. |
| 1270 should_cvc_be_requested_ = false; | 1270 should_cvc_be_requested_ = false; |
| 1271 if (upload_request_.cvc.empty()) { | 1271 if (upload_request_.cvc.empty()) { |
| 1272 if (IsAutofillUpstreamRequestCvcIfMissingExperimentEnabled()) { | 1272 if (get_profiles_succeeded && |
|
sebsg
2017/04/28 15:26:24
Do you think we could log something like "Not able
Jared Saul
2017/04/28 19:21:42
I think this is actually correct. In this branch,
csashi
2017/04/28 23:47:44
Acknowledged. I modified the conditions to perhaps
csashi
2017/04/28 23:47:45
Done.
sebsg
2017/05/01 02:46:20
Thank you!
csashi
2017/05/01 16:01:56
Acknowledged.
| |
| 1273 IsAutofillUpstreamRequestCvcIfMissingExperimentEnabled()) { | |
| 1273 should_cvc_be_requested_ = true; | 1274 should_cvc_be_requested_ = true; |
| 1274 } else { | 1275 } else { |
| 1275 AutofillMetrics::LogCardUploadDecisionMetric( | 1276 upload_decision_metrics.push_back( |
| 1276 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC); | 1277 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC); |
| 1277 LogCardUploadDecisionUkm(AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC); | 1278 rappor_metric_name = "Autofill.CardUploadNotOfferedNoCvc"; |
| 1278 pending_upload_request_url_ = GURL(); | |
| 1279 CollectRapportSample(submitted_form.source_url(), | |
| 1280 "Autofill.CardUploadNotOfferedNoCvc"); | |
| 1281 return; | |
| 1282 } | 1279 } |
| 1283 } | 1280 } |
| 1284 if (!get_profiles_succeeded) { | 1281 for (const auto it : upload_decision_metrics) |
| 1285 DCHECK(get_profiles_decision_metric != AutofillMetrics::UPLOAD_OFFERED); | 1282 AutofillMetrics::LogCardUploadDecisionMetric(it); |
|
sebsg
2017/04/28 15:26:24
Do you think you could pass the vector here too li
Jared Saul
2017/04/28 19:21:42
I'm definitely against doing it this way. Differe
csashi
2017/04/28 23:47:44
Thanks for the catch. Bit field will fix this for
csashi
2017/04/28 23:47:45
Done.
sebsg
2017/05/01 02:46:20
Yeah that's how I did it for Payment Request, one
csashi
2017/05/01 16:01:56
Acknowledged.
| |
| 1286 AutofillMetrics::LogCardUploadDecisionMetric( | 1283 if (!upload_decision_metrics.empty()) { |
| 1287 get_profiles_decision_metric); | 1284 LogCardUploadDecisionsUkm(upload_decision_metrics); |
| 1288 LogCardUploadDecisionUkm(get_profiles_decision_metric); | |
| 1289 pending_upload_request_url_ = GURL(); | 1285 pending_upload_request_url_ = GURL(); |
| 1290 if (!rappor_metric_name.empty()) { | |
| 1291 CollectRapportSample(submitted_form.source_url(), rappor_metric_name); | |
| 1292 } | |
| 1293 return; | 1286 return; |
| 1294 } | 1287 } |
| 1295 | 1288 |
| 1296 // All required data is available, start the upload process. | 1289 // All required data is available, start the upload process. |
| 1297 payments_client_->GetUploadDetails(upload_request_.profiles, app_locale_); | 1290 payments_client_->GetUploadDetails(upload_request_.profiles, app_locale_); |
| 1298 } | 1291 } |
| 1299 } | 1292 } |
| 1300 | 1293 |
| 1301 bool AutofillManager::GetProfilesForCreditCardUpload( | 1294 bool AutofillManager::GetProfilesForCreditCardUpload( |
| 1302 const CreditCard& card, | 1295 const CreditCard& card, |
| 1303 std::vector<AutofillProfile>* profiles, | 1296 std::vector<AutofillProfile>* profiles, |
| 1304 autofill::AutofillMetrics::CardUploadDecisionMetric* | 1297 std::vector<AutofillMetrics::CardUploadDecisionMetric>* |
| 1305 address_upload_decision_metric, | 1298 upload_decision_metrics, |
| 1306 std::string* rappor_metric_name) const { | 1299 std::string* rappor_metric_name) const { |
| 1307 std::vector<AutofillProfile> candidate_profiles; | 1300 std::vector<AutofillProfile> candidate_profiles; |
| 1308 const base::Time now = AutofillClock::Now(); | 1301 const base::Time now = AutofillClock::Now(); |
| 1309 const base::TimeDelta fifteen_minutes = base::TimeDelta::FromMinutes(15); | 1302 const base::TimeDelta fifteen_minutes = base::TimeDelta::FromMinutes(15); |
| 1310 | 1303 |
| 1311 // First, collect all of the addresses used recently. | 1304 // First, collect all of the addresses used recently. |
| 1312 for (AutofillProfile* profile : personal_data_->GetProfiles()) { | 1305 for (AutofillProfile* profile : personal_data_->GetProfiles()) { |
| 1313 if ((now - profile->use_date()) < fifteen_minutes || | 1306 if ((now - profile->use_date()) < fifteen_minutes || |
| 1314 (now - profile->modification_date()) < fifteen_minutes) { | 1307 (now - profile->modification_date()) < fifteen_minutes) { |
| 1315 candidate_profiles.push_back(*profile); | 1308 candidate_profiles.push_back(*profile); |
| 1316 } | 1309 } |
| 1317 } | 1310 } |
| 1318 if (candidate_profiles.empty()) { | 1311 if (candidate_profiles.empty()) { |
| 1319 *address_upload_decision_metric = | 1312 upload_decision_metrics->push_back( |
| 1320 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ADDRESS; | 1313 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ADDRESS); |
| 1321 *rappor_metric_name = "Autofill.CardUploadNotOfferedNoAddress"; | 1314 *rappor_metric_name = "Autofill.CardUploadNotOfferedNoAddress"; |
| 1322 return false; | |
| 1323 } | 1315 } |
| 1324 | 1316 |
| 1325 // If any of the names on the card or the addresses don't match (where | 1317 // If any of the names on the card or the addresses don't match (where |
| 1326 // matching is case insensitive and ignores middle initials if present), the | 1318 // matching is case insensitive and ignores middle initials if present), the |
| 1327 // candidate set is invalid. This matches the rules for name matching applied | 1319 // candidate set is invalid. This matches the rules for name matching applied |
| 1328 // server-side by Google Payments and ensures that we don't send upload | 1320 // server-side by Google Payments and ensures that we don't send upload |
| 1329 // requests that are guaranteed to fail. | 1321 // requests that are guaranteed to fail. |
| 1330 base::string16 verified_name; | 1322 base::string16 verified_name; |
| 1331 base::string16 card_name = | 1323 const base::string16 card_name = |
| 1332 card.GetInfo(AutofillType(CREDIT_CARD_NAME_FULL), app_locale_); | 1324 card.GetInfo(AutofillType(CREDIT_CARD_NAME_FULL), app_locale_); |
| 1333 if (!card_name.empty()) { | 1325 if (!card_name.empty()) { |
| 1334 verified_name = RemoveMiddleInitial(card_name); | 1326 verified_name = RemoveMiddleInitial(card_name); |
| 1335 } | 1327 } |
| 1336 for (const AutofillProfile& profile : candidate_profiles) { | 1328 for (const AutofillProfile& profile : candidate_profiles) { |
| 1337 base::string16 address_name = | 1329 const base::string16 address_name = |
| 1338 profile.GetInfo(AutofillType(NAME_FULL), app_locale_); | 1330 profile.GetInfo(AutofillType(NAME_FULL), app_locale_); |
| 1339 if (!address_name.empty()) { | 1331 if (!address_name.empty()) { |
| 1340 if (verified_name.empty()) { | 1332 if (verified_name.empty()) { |
| 1341 verified_name = RemoveMiddleInitial(address_name); | 1333 verified_name = RemoveMiddleInitial(address_name); |
| 1342 } else { | 1334 } else { |
| 1343 // TODO(crbug.com/590307): We only use ASCII case insensitivity here | 1335 // TODO(crbug.com/590307): We'll need to make the name comparison more |
| 1344 // because the feature is launching US-only and middle initials only | 1336 // sophisticated. |
| 1345 // make sense for Western-style names anyway. As we launch in more | |
| 1346 // countries, we'll need to make the name comparison more sophisticated. | |
| 1347 if (!base::EqualsCaseInsensitiveASCII( | 1337 if (!base::EqualsCaseInsensitiveASCII( |
| 1348 verified_name, RemoveMiddleInitial(address_name))) { | 1338 verified_name, RemoveMiddleInitial(address_name))) { |
| 1349 *address_upload_decision_metric = | 1339 if (upload_decision_metrics->empty()) |
| 1350 AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_NAMES; | 1340 *rappor_metric_name = |
| 1351 *rappor_metric_name = "Autofill.CardUploadNotOfferedConflictingNames"; | 1341 "Autofill.CardUploadNotOfferedConflictingNames"; |
| 1352 return false; | 1342 upload_decision_metrics->push_back( |
| 1343 AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_NAMES); | |
| 1344 break; | |
| 1353 } | 1345 } |
| 1354 } | 1346 } |
| 1355 } | 1347 } |
| 1356 } | 1348 } |
| 1357 // If neither the card nor any of the addresses have a name associated with | 1349 // If neither the card nor any of the addresses have a name associated with |
| 1358 // them, the candidate set is invalid. | 1350 // them, the candidate set is invalid. |
| 1359 if (verified_name.empty()) { | 1351 if (verified_name.empty()) { |
| 1360 *address_upload_decision_metric = | 1352 if (upload_decision_metrics->empty()) |
| 1361 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_NAME; | 1353 *rappor_metric_name = "Autofill.CardUploadNotOfferedNoName"; |
| 1362 *rappor_metric_name = "Autofill.CardUploadNotOfferedNoName"; | 1354 upload_decision_metrics->push_back( |
| 1363 return false; | 1355 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_NAME); |
| 1364 } | 1356 } |
| 1365 | 1357 |
| 1366 // If any of the candidate addresses have a non-empty zip that doesn't match | 1358 // If any of the candidate addresses have a non-empty zip that doesn't match |
| 1367 // any other non-empty zip, then the candidate set is invalid. | 1359 // any other non-empty zip, then the candidate set is invalid. |
| 1368 base::string16 verified_zip; | 1360 base::string16 verified_zip; |
| 1369 for (const AutofillProfile& profile : candidate_profiles) { | 1361 for (const AutofillProfile& profile : candidate_profiles) { |
| 1370 // TODO(jdonnelly): Use GetInfo instead of GetRawInfo once zip codes are | 1362 // TODO(jdonnelly): Use GetInfo instead of GetRawInfo once zip codes are |
| 1371 // canonicalized. See http://crbug.com/587465. | 1363 // canonicalized. See http://crbug.com/587465. |
| 1372 base::string16 zip = profile.GetRawInfo(ADDRESS_HOME_ZIP); | 1364 const base::string16 zip = profile.GetRawInfo(ADDRESS_HOME_ZIP); |
| 1373 if (!zip.empty()) { | 1365 if (!zip.empty()) { |
| 1374 if (verified_zip.empty()) { | 1366 if (verified_zip.empty()) { |
| 1375 verified_zip = zip; | 1367 verified_zip = zip; |
| 1376 } else { | 1368 } else { |
| 1377 // To compare two zips, we check to see if either is a prefix of the | 1369 // To compare two zips, we check to see if either is a prefix of the |
| 1378 // other. This allows us to consider a 5-digit zip and a zip+4 to be a | 1370 // other. This allows us to consider a 5-digit zip and a zip+4 to be a |
| 1379 // match if the first 5 digits are the same without hardcoding any | 1371 // match if the first 5 digits are the same without hardcoding any |
| 1380 // specifics of how postal codes are represented. (They can be numeric | 1372 // specifics of how postal codes are represented. (They can be numeric |
| 1381 // or alphanumeric and vary from 3 to 10 digits long by country. See | 1373 // or alphanumeric and vary from 3 to 10 digits long by country. See |
| 1382 // https://en.wikipedia.org/wiki/Postal_code#Presentation.) The Payments | 1374 // https://en.wikipedia.org/wiki/Postal_code#Presentation.) The Payments |
| 1383 // backend will apply a more sophisticated address-matching procedure. | 1375 // backend will apply a more sophisticated address-matching procedure. |
| 1384 // This check is simply meant to avoid offering upload in cases that are | 1376 // This check is simply meant to avoid offering upload in cases that are |
| 1385 // likely to fail. | 1377 // likely to fail. |
| 1386 if (!(StartsWith(verified_zip, zip, base::CompareCase::SENSITIVE) || | 1378 if (!(StartsWith(verified_zip, zip, base::CompareCase::SENSITIVE) || |
| 1387 StartsWith(zip, verified_zip, base::CompareCase::SENSITIVE))) { | 1379 StartsWith(zip, verified_zip, base::CompareCase::SENSITIVE))) { |
| 1388 *address_upload_decision_metric = | 1380 upload_decision_metrics->push_back( |
| 1389 AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_ZIPS; | 1381 AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_ZIPS); |
| 1390 return false; | 1382 break; |
| 1391 } | 1383 } |
| 1392 } | 1384 } |
| 1393 } | 1385 } |
| 1394 } | 1386 } |
| 1395 | 1387 |
| 1396 // If none of the candidate addresses have a zip, the candidate set is | 1388 // If none of the candidate addresses have a zip, the candidate set is |
| 1397 // invalid. | 1389 // invalid. |
| 1398 if (verified_zip.empty()) { | 1390 if (verified_zip.empty()) { |
| 1399 *address_upload_decision_metric = | 1391 upload_decision_metrics->push_back( |
| 1400 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE; | 1392 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE); |
| 1401 return false; | |
| 1402 } | 1393 } |
| 1403 | 1394 |
| 1404 profiles->assign(candidate_profiles.begin(), candidate_profiles.end()); | 1395 if (upload_decision_metrics->empty()) { |
| 1405 return true; | 1396 profiles->assign(candidate_profiles.begin(), candidate_profiles.end()); |
| 1397 return true; | |
| 1398 } | |
| 1399 return false; | |
| 1406 } | 1400 } |
| 1407 | 1401 |
| 1408 void AutofillManager::CollectRapportSample(const GURL& source_url, | 1402 void AutofillManager::CollectRapporSample( |
| 1409 const std::string& metric_name) | 1403 const GURL& source_url, |
| 1410 const { | 1404 const std::string& metric_name) const { |
| 1411 if (source_url.is_valid() && client_->GetRapporServiceImpl()) { | 1405 if (source_url.is_valid() && client_->GetRapporServiceImpl()) { |
| 1412 rappor::SampleDomainAndRegistryFromGURL(client_->GetRapporServiceImpl(), | 1406 rappor::SampleDomainAndRegistryFromGURL(client_->GetRapporServiceImpl(), |
| 1413 metric_name, source_url); | 1407 metric_name, source_url); |
| 1414 } | 1408 } |
| 1415 } | 1409 } |
| 1416 | 1410 |
| 1417 // Note that |submitted_form| is passed as a pointer rather than as a reference | 1411 // Note that |submitted_form| is passed as a pointer rather than as a reference |
| 1418 // so that we can get memory management right across threads. Note also that we | 1412 // so that we can get memory management right across threads. Note also that we |
| 1419 // explicitly pass in all the time stamps of interest, as the cached ones might | 1413 // explicitly pass in all the time stamps of interest, as the cached ones might |
| 1420 // get reset before this method executes. | 1414 // get reset before this method executes. |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2252 } | 2246 } |
| 2253 if (i > 0) | 2247 if (i > 0) |
| 2254 fputs("Next oldest form:\n", file); | 2248 fputs("Next oldest form:\n", file); |
| 2255 } | 2249 } |
| 2256 fputs("\n", file); | 2250 fputs("\n", file); |
| 2257 | 2251 |
| 2258 fclose(file); | 2252 fclose(file); |
| 2259 } | 2253 } |
| 2260 #endif // ENABLE_FORM_DEBUG_DUMP | 2254 #endif // ENABLE_FORM_DEBUG_DUMP |
| 2261 | 2255 |
| 2262 void AutofillManager::LogCardUploadDecisionUkm( | 2256 void AutofillManager::LogCardUploadDecisionsUkm( |
| 2263 AutofillMetrics::CardUploadDecisionMetric upload_decision) { | 2257 const std::vector<AutofillMetrics::CardUploadDecisionMetric>& |
| 2264 AutofillMetrics::LogCardUploadDecisionUkm( | 2258 upload_decision_metrics) { |
| 2265 client_->GetUkmService(), pending_upload_request_url_, upload_decision); | 2259 AutofillMetrics::LogCardUploadDecisionsUkm(client_->GetUkmService(), |
| 2260 pending_upload_request_url_, | |
| 2261 upload_decision_metrics); | |
|
Jared Saul
2017/04/28 19:21:42
still nit but very confused about style formatting
csashi
2017/05/01 16:01:56
Acknowledged.
| |
| 2266 } | 2262 } |
| 2267 | 2263 |
| 2268 } // namespace autofill | 2264 } // namespace autofill |
| OLD | NEW |