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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 if (identifier < 0) | 888 if (identifier < 0) |
889 return false; | 889 return false; |
890 | 890 |
891 const CreditCard* credit_card = nullptr; | 891 const CreditCard* credit_card = nullptr; |
892 const AutofillProfile* profile = nullptr; | 892 const AutofillProfile* profile = nullptr; |
893 if (GetCreditCard(identifier, &credit_card)) { | 893 if (GetCreditCard(identifier, &credit_card)) { |
894 if (credit_card->record_type() != CreditCard::LOCAL_CARD) | 894 if (credit_card->record_type() != CreditCard::LOCAL_CARD) |
895 return false; | 895 return false; |
896 | 896 |
897 if (title) | 897 if (title) |
898 title->assign(credit_card->TypeAndLastFourDigits()); | 898 title->assign(credit_card->NetworkAndLastFourDigits()); |
899 if (body) { | 899 if (body) { |
900 body->assign(l10n_util::GetStringUTF16( | 900 body->assign(l10n_util::GetStringUTF16( |
901 IDS_AUTOFILL_DELETE_CREDIT_CARD_SUGGESTION_CONFIRMATION_BODY)); | 901 IDS_AUTOFILL_DELETE_CREDIT_CARD_SUGGESTION_CONFIRMATION_BODY)); |
902 } | 902 } |
903 | 903 |
904 return true; | 904 return true; |
905 } else if (GetProfile(identifier, &profile)) { | 905 } else if (GetProfile(identifier, &profile)) { |
906 if (profile->record_type() != AutofillProfile::LOCAL_PROFILE) | 906 if (profile->record_type() != AutofillProfile::LOCAL_PROFILE) |
907 return false; | 907 return false; |
908 | 908 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 | 1239 |
1240 // Check for a CVC to determine whether we can prompt the user to upload | 1240 // Check for a CVC to determine whether we can prompt the user to upload |
1241 // their card. If no CVC is present and the experiment is off, do nothing. | 1241 // their card. If no CVC is present and the experiment is off, do nothing. |
1242 // We could fall back to a local save but we believe that sometimes offering | 1242 // We could fall back to a local save but we believe that sometimes offering |
1243 // upload and sometimes offering local save is a confusing user experience. | 1243 // upload and sometimes offering local save is a confusing user experience. |
1244 // If no CVC and the experiment is on, request CVC from the user in the | 1244 // If no CVC and the experiment is on, request CVC from the user in the |
1245 // bubble and save using the provided value. | 1245 // bubble and save using the provided value. |
1246 for (const auto& field : submitted_form) { | 1246 for (const auto& field : submitted_form) { |
1247 if (field->Type().GetStorableType() == CREDIT_CARD_VERIFICATION_CODE && | 1247 if (field->Type().GetStorableType() == CREDIT_CARD_VERIFICATION_CODE && |
1248 IsValidCreditCardSecurityCode(field->value, | 1248 IsValidCreditCardSecurityCode(field->value, |
1249 upload_request_.card.type())) { | 1249 upload_request_.card.network())) { |
1250 upload_request_.cvc = field->value; | 1250 upload_request_.cvc = field->value; |
1251 break; | 1251 break; |
1252 } | 1252 } |
1253 } | 1253 } |
1254 | 1254 |
1255 // Upload requires that recently used or modified addresses meet the | 1255 // Upload requires that recently used or modified addresses meet the |
1256 // client-side validation rules. | 1256 // client-side validation rules. |
1257 autofill::AutofillMetrics::CardUploadDecisionMetric | 1257 autofill::AutofillMetrics::CardUploadDecisionMetric |
1258 get_profiles_decision_metric = AutofillMetrics::UPLOAD_OFFERED; | 1258 get_profiles_decision_metric = AutofillMetrics::UPLOAD_OFFERED; |
1259 std::string rappor_metric_name; | 1259 std::string rappor_metric_name; |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2259 } | 2259 } |
2260 #endif // ENABLE_FORM_DEBUG_DUMP | 2260 #endif // ENABLE_FORM_DEBUG_DUMP |
2261 | 2261 |
2262 void AutofillManager::LogCardUploadDecisionUkm( | 2262 void AutofillManager::LogCardUploadDecisionUkm( |
2263 AutofillMetrics::CardUploadDecisionMetric upload_decision) { | 2263 AutofillMetrics::CardUploadDecisionMetric upload_decision) { |
2264 AutofillMetrics::LogCardUploadDecisionUkm( | 2264 AutofillMetrics::LogCardUploadDecisionUkm( |
2265 client_->GetUkmService(), pending_upload_request_url_, upload_decision); | 2265 client_->GetUkmService(), pending_upload_request_url_, upload_decision); |
2266 } | 2266 } |
2267 | 2267 |
2268 } // namespace autofill | 2268 } // namespace autofill |
OLD | NEW |