// Copyright 2024 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/autofill/core/browser/crowdsourcing/disambiguate_possible_field_types.h" #include "components/autofill/core/browser/autofill_field.h" #include "components/autofill/core/browser/field_type_utils.h" #include "components/autofill/core/browser/form_structure.h" #include "components/autofill/core/common/autofill_features.h" namespace autofill { namespace { // Returns `true` if `field` contains multiple possible types. bool MayHaveAmbiguousPossibleTypes(const AutofillField& field) { … } // Returns whether the `field` is predicted as being any kind of name. bool IsNameType(const AutofillField& field) { … } // Selects the probable name types for the possible field types of the `field`. // If `is_credit_card` is true, credit card name types are retained and // address name types are discarded. If `is_credit_card` is false, the opposite // happens. This is called when we have multiple possible name types from mixed // field type groups. void SelectProbableNameTypes(AutofillField& field, bool select_credit_card_names) { … } // If a field was autofilled on form submission and the value was accepted, set // possible types to the autofilled type. void SetPossibleTypesToAutofilledTypeIfAvailable(AutofillField& field) { … } // Disambiguates name types from mixed field type groups when the name exists in // both a profile and a credit card. `current_field_index` is the index of the // field whose possible types are attempted to be disambiguated. // Note that generally a name field can legitimately have multiple types // according to the types tree structure, e.g. `NAME_FULL`, `NAME_LAST` and // `NAME_LAST_{FIRST,SECOND}` at the same time. void MaybeDisambiguateNameTypes(FormStructure& form, size_t current_field_index) { … } } // namespace void DisambiguatePossibleFieldTypes(FormStructure& form) { … } } // namespace autofill