chromium/components/autofill/core/browser/autofill_field.cc

// Copyright 2013 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/autofill_field.h"

#include <stdint.h>
#include <iterator>

#include "base/containers/contains.h"
#include "base/containers/fixed_flat_set.h"
#include "base/feature_list.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/types/cxx23_to_underlying.h"
#include "components/autofill/core/browser/field_type_utils.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/proto/server.pb.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/dense_set.h"
#include "components/autofill/core/common/html_field_types.h"
#include "components/autofill/core/common/signatures.h"

namespace autofill {

FieldPrediction;

template <>
struct DenseSetTraits<FieldPrediction::Source> {};

namespace {

// This list includes pairs (heuristic_type, html_type) that express which
// heuristic predictions should be prioritized over HTML. The list is used for
// new field types that do not have a clear corresponding HTML type. In these
// cases, the local heuristics predictions will be used to determine the field
// overall type.
static constexpr auto kAutofillHeuristicsVsHtmlOverrides =;

// This list includes pairs (heuristic_type, server_type) that express which
// heuristics predictions should be prioritized over server predictions. The
// list is used for new field types that the server may have learned
// incorrectly. In these cases, the local heuristics predictions will be used to
// determine the field type.
static constexpr auto kAutofillHeuristicsVsServerOverrides =;

// Returns true, if the prediction is non-experimental and should be used by
// autofill or password manager.
// Note: A `NO_SERVER_DATA` prediction with `SOURCE_UNSPECIFIED` may also be a
// default prediction. We don't need to store it, because its meaning is that
// there is no default prediction.
bool IsDefaultPrediction(const FieldPrediction& prediction) {}

// Returns true if for two consecutive events, the second event may be ignored.
// In that case, if `event1` is at the back of AutofillField::field_log_events_,
// `event2` is not supposed to be added.
bool AreCollapsibleLogEvents(const AutofillField::FieldLogEventType& event1,
                             const AutofillField::FieldLogEventType& event2) {}

// Returns whether the `heuristic_type` should be preferred over the
// `html_type`. For certain field types that have been recently introduced, we
// want to prioritize local heuristics over the autocomplete type.
bool PreferHeuristicOverHtml(FieldType heuristic_type,
                             HtmlFieldType html_type) {}

// Returns whether the `heuristic_type` should be preferred over the
// `server_type`. For certain field types that have been recently introduced, we
// want to prioritize the local heuristics predictions because they are more
// likely to be accurate. By prioritizing the local heuristics predictions, we
// can help the server to "learn" the correct classification for these fields.
bool PreferHeuristicOverServer(FieldType heuristic_type,
                               FieldType server_type) {}

// Util function for `ComputedType`. Returns the values of HtmlFieldType that
// won't be overridden by heuristics or server predictions, up to a few
// exceptions. Check function `ComputedType` for more details.
DenseSet<HtmlFieldType> BelievedHtmlTypes(FieldType heuristic_prediction,
                                          FieldType server_prediction) {}

}  // namespace

AutofillField::AutofillField() {}

AutofillField::AutofillField(FieldSignature field_signature) :{}

AutofillField::AutofillField(const FormFieldData& field)
    :{}

AutofillField::AutofillField(AutofillField&&) = default;

AutofillField& AutofillField::operator=(AutofillField&&) = default;

AutofillField::~AutofillField() = default;

std::unique_ptr<AutofillField> AutofillField::CreateForPasswordManagerUpload(
    FieldSignature field_signature) {}

FieldType AutofillField::heuristic_type() const {}

FieldType AutofillField::heuristic_type(HeuristicSource s) const {}

FieldType AutofillField::server_type() const {}

bool AutofillField::server_type_prediction_is_override() const {}

void AutofillField::set_heuristic_type(HeuristicSource s, FieldType type) {}

void AutofillField::set_server_predictions(
    std::vector<FieldPrediction> predictions) {}

void AutofillField::SetHtmlType(HtmlFieldType type, HtmlFieldMode mode) {}

void AutofillField::SetTypeTo(const AutofillType& type) {}

AutofillType AutofillField::ComputedType() const {}

AutofillType AutofillField::Type() const {}

bool AutofillField::IsEmpty() const {}

FieldSignature AutofillField::GetFieldSignature() const {}

std::string AutofillField::FieldSignatureAsStr() const {}

bool AutofillField::IsFieldFillable() const {}

bool AutofillField::HasExpirationDateType() const {}

bool AutofillField::ShouldSuppressSuggestionsAndFillingByDefault() const {}

void AutofillField::SetPasswordRequirements(PasswordRequirementsSpec spec) {}

bool AutofillField::IsCreditCardPrediction() const {}

void AutofillField::AppendLogEventIfNotRepeated(
    const FieldLogEventType& log_event) {}

bool AutofillField::WasAutofilledWithFallback() const {}

}  // namespace autofill