| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "components/autofill/core/browser/autofill_profile.h" | 43 #include "components/autofill/core/browser/autofill_profile.h" |
| 44 #include "components/autofill/core/browser/autofill_type.h" | 44 #include "components/autofill/core/browser/autofill_type.h" |
| 45 #include "components/autofill/core/browser/country_names.h" | 45 #include "components/autofill/core/browser/country_names.h" |
| 46 #include "components/autofill/core/browser/credit_card.h" | 46 #include "components/autofill/core/browser/credit_card.h" |
| 47 #include "components/autofill/core/browser/field_types.h" | 47 #include "components/autofill/core/browser/field_types.h" |
| 48 #include "components/autofill/core/browser/form_structure.h" | 48 #include "components/autofill/core/browser/form_structure.h" |
| 49 #include "components/autofill/core/browser/personal_data_manager.h" | 49 #include "components/autofill/core/browser/personal_data_manager.h" |
| 50 #include "components/autofill/core/browser/phone_number.h" | 50 #include "components/autofill/core/browser/phone_number.h" |
| 51 #include "components/autofill/core/browser/phone_number_i18n.h" | 51 #include "components/autofill/core/browser/phone_number_i18n.h" |
| 52 #include "components/autofill/core/browser/popup_item_ids.h" | 52 #include "components/autofill/core/browser/popup_item_ids.h" |
| 53 #include "components/autofill/core/browser/validation.h" |
| 53 #include "components/autofill/core/common/autofill_constants.h" | 54 #include "components/autofill/core/common/autofill_constants.h" |
| 54 #include "components/autofill/core/common/autofill_data_validation.h" | 55 #include "components/autofill/core/common/autofill_data_validation.h" |
| 55 #include "components/autofill/core/common/autofill_pref_names.h" | 56 #include "components/autofill/core/common/autofill_pref_names.h" |
| 56 #include "components/autofill/core/common/autofill_util.h" | 57 #include "components/autofill/core/common/autofill_util.h" |
| 57 #include "components/autofill/core/common/form_data.h" | 58 #include "components/autofill/core/common/form_data.h" |
| 58 #include "components/autofill/core/common/form_data_predictions.h" | 59 #include "components/autofill/core/common/form_data_predictions.h" |
| 59 #include "components/autofill/core/common/form_field_data.h" | 60 #include "components/autofill/core/common/form_field_data.h" |
| 60 #include "components/autofill/core/common/password_form_fill_data.h" | 61 #include "components/autofill/core/common/password_form_fill_data.h" |
| 61 #include "components/pref_registry/pref_registry_syncable.h" | 62 #include "components/pref_registry/pref_registry_syncable.h" |
| 62 #include "components/prefs/pref_service.h" | 63 #include "components/prefs/pref_service.h" |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 // Whereas, because we pass IsCreditCardUploadEnabled() to ImportFormData, | 1157 // Whereas, because we pass IsCreditCardUploadEnabled() to ImportFormData, |
| 1157 // this block can be reached on observing either a new card or one already | 1158 // this block can be reached on observing either a new card or one already |
| 1158 // stored locally. We will offer to upload either kind. | 1159 // stored locally. We will offer to upload either kind. |
| 1159 upload_request_ = payments::PaymentsClient::UploadRequestDetails(); | 1160 upload_request_ = payments::PaymentsClient::UploadRequestDetails(); |
| 1160 upload_request_.card = *imported_credit_card; | 1161 upload_request_.card = *imported_credit_card; |
| 1161 | 1162 |
| 1162 // Check for a CVC to determine whether we can prompt the user to upload | 1163 // Check for a CVC to determine whether we can prompt the user to upload |
| 1163 // their card. If no CVC is present, do nothing. We could fall back to a | 1164 // their card. If no CVC is present, do nothing. We could fall back to a |
| 1164 // local save but we believe that sometimes offering upload and sometimes | 1165 // local save but we believe that sometimes offering upload and sometimes |
| 1165 // offering local save is a confusing user experience. | 1166 // offering local save is a confusing user experience. |
| 1166 int cvc; | |
| 1167 for (const auto& field : submitted_form) { | 1167 for (const auto& field : submitted_form) { |
| 1168 if (field->Type().GetStorableType() == CREDIT_CARD_VERIFICATION_CODE && | 1168 if (field->Type().GetStorableType() == CREDIT_CARD_VERIFICATION_CODE && |
| 1169 base::StringToInt(field->value, &cvc)) { | 1169 IsValidCreditCardSecurityCode(field->value, |
| 1170 upload_request_.card.type())) { |
| 1170 upload_request_.cvc = field->value; | 1171 upload_request_.cvc = field->value; |
| 1171 break; | 1172 break; |
| 1172 } | 1173 } |
| 1173 } | 1174 } |
| 1174 if (upload_request_.cvc.empty()) { | 1175 if (upload_request_.cvc.empty()) { |
| 1175 AutofillMetrics::LogCardUploadDecisionMetric( | 1176 AutofillMetrics::LogCardUploadDecisionMetric( |
| 1176 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC); | 1177 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC); |
| 1177 CollectRapportSample(submitted_form.source_url(), | 1178 CollectRapportSample(submitted_form.source_url(), |
| 1178 "Autofill.CardUploadNotOfferedNoCvc"); | 1179 "Autofill.CardUploadNotOfferedNoCvc"); |
| 1179 return; | 1180 return; |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2137 if (i > 0) | 2138 if (i > 0) |
| 2138 fputs("Next oldest form:\n", file); | 2139 fputs("Next oldest form:\n", file); |
| 2139 } | 2140 } |
| 2140 fputs("\n", file); | 2141 fputs("\n", file); |
| 2141 | 2142 |
| 2142 fclose(file); | 2143 fclose(file); |
| 2143 } | 2144 } |
| 2144 #endif // ENABLE_FORM_DEBUG_DUMP | 2145 #endif // ENABLE_FORM_DEBUG_DUMP |
| 2145 | 2146 |
| 2146 } // namespace autofill | 2147 } // namespace autofill |
| OLD | NEW |