| Index: components/autofill/core/browser/form_structure.cc
|
| diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc
|
| index 580817452f2ff6faba81415fd60db244d4ea469f..19c6d55c1271ca3229a45cb96bd58d1af48220e5 100644
|
| --- a/components/autofill/core/browser/form_structure.cc
|
| +++ b/components/autofill/core/browser/form_structure.cc
|
| @@ -290,6 +290,14 @@ std::ostream& operator<<(
|
| return out;
|
| }
|
|
|
| +bool IsCreditCardExpirationType(ServerFieldType type) {
|
| + return type == CREDIT_CARD_EXP_MONTH ||
|
| + type == CREDIT_CARD_EXP_2_DIGIT_YEAR ||
|
| + type == CREDIT_CARD_EXP_4_DIGIT_YEAR ||
|
| + type == CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR ||
|
| + type == CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR;
|
| +}
|
| +
|
| } // namespace
|
|
|
| FormStructure::FormStructure(const FormData& form)
|
| @@ -577,6 +585,23 @@ bool FormStructure::IsAutofillable() const {
|
| return ShouldBeParsed();
|
| }
|
|
|
| +bool FormStructure::IsCompleteCreditCardForm() const {
|
| + bool found_cc_number = false;
|
| + bool found_cc_expiration = false;
|
| + for (const AutofillField* field : fields_) {
|
| + ServerFieldType type = field->Type().GetStorableType();
|
| + if (!found_cc_expiration && IsCreditCardExpirationType(type)) {
|
| + found_cc_expiration = true;
|
| + continue;
|
| + }
|
| + if (!found_cc_number && type == CREDIT_CARD_NUMBER) {
|
| + found_cc_number = true;
|
| + continue;
|
| + }
|
| + }
|
| + return found_cc_number && found_cc_expiration;
|
| +}
|
| +
|
| void FormStructure::UpdateAutofillCount() {
|
| autofill_count_ = 0;
|
| for (const AutofillField* field : *this) {
|
|
|