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 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 bool AutofillManager::WillFillCreditCardNumber(const FormData& form, | 544 bool AutofillManager::WillFillCreditCardNumber(const FormData& form, |
545 const FormFieldData& field) { | 545 const FormFieldData& field) { |
546 FormStructure* form_structure = nullptr; | 546 FormStructure* form_structure = nullptr; |
547 AutofillField* autofill_field = nullptr; | 547 AutofillField* autofill_field = nullptr; |
548 if (!GetCachedFormAndField(form, field, &form_structure, &autofill_field)) | 548 if (!GetCachedFormAndField(form, field, &form_structure, &autofill_field)) |
549 return false; | 549 return false; |
550 | 550 |
551 if (autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER) | 551 if (autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER) |
552 return true; | 552 return true; |
553 | 553 |
| 554 #if defined(OS_IOS) |
| 555 // On iOS, we only fill out one field at a time. So we only need to check the |
| 556 // current field. |
| 557 return false; |
| 558 #endif |
| 559 |
554 // If the relevant section is already autofilled, the new fill operation will | 560 // If the relevant section is already autofilled, the new fill operation will |
555 // only fill |autofill_field|. | 561 // only fill |autofill_field|. |
556 if (SectionIsAutofilled(*form_structure, form, autofill_field->section())) | 562 if (SectionIsAutofilled(*form_structure, form, autofill_field->section())) |
557 return false; | 563 return false; |
558 | 564 |
559 DCHECK_EQ(form_structure->field_count(), form.fields.size()); | 565 DCHECK_EQ(form_structure->field_count(), form.fields.size()); |
560 for (size_t i = 0; i < form_structure->field_count(); ++i) { | 566 for (size_t i = 0; i < form_structure->field_count(); ++i) { |
561 if (form_structure->field(i)->section() == autofill_field->section() && | 567 if (form_structure->field(i)->section() == autofill_field->section() && |
562 form_structure->field(i)->Type().GetStorableType() == | 568 form_structure->field(i)->Type().GetStorableType() == |
563 CREDIT_CARD_NUMBER && | 569 CREDIT_CARD_NUMBER && |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 return false; | 1517 return false; |
1512 | 1518 |
1513 // Disregard forms that we wouldn't ever autofill in the first place. | 1519 // Disregard forms that we wouldn't ever autofill in the first place. |
1514 if (!form.ShouldBeParsed()) | 1520 if (!form.ShouldBeParsed()) |
1515 return false; | 1521 return false; |
1516 | 1522 |
1517 return true; | 1523 return true; |
1518 } | 1524 } |
1519 | 1525 |
1520 } // namespace autofill | 1526 } // namespace autofill |
OLD | NEW |