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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "components/pref_registry/pref_registry_syncable.h" | 59 #include "components/pref_registry/pref_registry_syncable.h" |
60 #include "components/prefs/pref_service.h" | 60 #include "components/prefs/pref_service.h" |
61 #include "components/rappor/rappor_utils.h" | 61 #include "components/rappor/rappor_utils.h" |
62 #include "google_apis/gaia/identity_provider.h" | 62 #include "google_apis/gaia/identity_provider.h" |
63 #include "grit/components_strings.h" | 63 #include "grit/components_strings.h" |
64 #include "ui/base/l10n/l10n_util.h" | 64 #include "ui/base/l10n/l10n_util.h" |
65 #include "ui/gfx/geometry/rect.h" | 65 #include "ui/gfx/geometry/rect.h" |
66 #include "url/gurl.h" | 66 #include "url/gurl.h" |
67 | 67 |
68 #if defined(OS_IOS) | 68 #if defined(OS_IOS) |
69 #include "components/autofill/core/browser/autofill_field_trial_ios.h" | |
70 #include "components/autofill/core/browser/keyboard_accessory_metrics_logger.h" | 69 #include "components/autofill/core/browser/keyboard_accessory_metrics_logger.h" |
71 #endif | 70 #endif |
72 | 71 |
73 namespace autofill { | 72 namespace autofill { |
74 | 73 |
75 using base::StartsWith; | 74 using base::StartsWith; |
76 using base::TimeTicks; | 75 using base::TimeTicks; |
77 | 76 |
78 namespace { | 77 namespace { |
79 | 78 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 bool AutofillManager::WillFillCreditCardNumber(const FormData& form, | 583 bool AutofillManager::WillFillCreditCardNumber(const FormData& form, |
585 const FormFieldData& field) { | 584 const FormFieldData& field) { |
586 FormStructure* form_structure = nullptr; | 585 FormStructure* form_structure = nullptr; |
587 AutofillField* autofill_field = nullptr; | 586 AutofillField* autofill_field = nullptr; |
588 if (!GetCachedFormAndField(form, field, &form_structure, &autofill_field)) | 587 if (!GetCachedFormAndField(form, field, &form_structure, &autofill_field)) |
589 return false; | 588 return false; |
590 | 589 |
591 if (autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER) | 590 if (autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER) |
592 return true; | 591 return true; |
593 | 592 |
594 #if defined(OS_IOS) | |
595 // On iOS, we only fill out one field at a time (assuming the new full-form | |
596 // feature isn't enabled). So we only need to check the current field. | |
597 if (!AutofillFieldTrialIOS::IsFullFormAutofillEnabled()) | |
598 return false; | |
599 #endif | |
600 | |
601 // If the relevant section is already autofilled, the new fill operation will | 593 // If the relevant section is already autofilled, the new fill operation will |
602 // only fill |autofill_field|. | 594 // only fill |autofill_field|. |
603 if (SectionIsAutofilled(*form_structure, form, autofill_field->section())) | 595 if (SectionIsAutofilled(*form_structure, form, autofill_field->section())) |
604 return false; | 596 return false; |
605 | 597 |
606 DCHECK_EQ(form_structure->field_count(), form.fields.size()); | 598 DCHECK_EQ(form_structure->field_count(), form.fields.size()); |
607 for (size_t i = 0; i < form_structure->field_count(); ++i) { | 599 for (size_t i = 0; i < form_structure->field_count(); ++i) { |
608 if (form_structure->field(i)->section() == autofill_field->section() && | 600 if (form_structure->field(i)->section() == autofill_field->section() && |
609 form_structure->field(i)->Type().GetStorableType() == | 601 form_structure->field(i)->Type().GetStorableType() == |
610 CREDIT_CARD_NUMBER && | 602 CREDIT_CARD_NUMBER && |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2026 if (i > 0) | 2018 if (i > 0) |
2027 fputs("Next oldest form:\n", file); | 2019 fputs("Next oldest form:\n", file); |
2028 } | 2020 } |
2029 fputs("\n", file); | 2021 fputs("\n", file); |
2030 | 2022 |
2031 fclose(file); | 2023 fclose(file); |
2032 } | 2024 } |
2033 #endif // ENABLE_FORM_DEBUG_DUMP | 2025 #endif // ENABLE_FORM_DEBUG_DUMP |
2034 | 2026 |
2035 } // namespace autofill | 2027 } // namespace autofill |
OLD | NEW |