chromium/components/autofill/core/common/autocomplete_parsing_util.cc

// Copyright 2022 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/common/autocomplete_parsing_util.h"

#include <vector>

#include "base/containers/fixed_flat_map.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_regexes.h"
#include "components/autofill/core/common/autofill_util.h"
#include "components/autofill/core/common/html_field_types.h"

namespace autofill {
namespace {

static constexpr auto kStandardizedAttributes =;

// If an autocomplete attribute length is larger than this cap, there is no need
// to bother checking if the developer made an honest mistake.
static constexpr int kMaxAutocompleteLengthToCheckForWellIntendedUsage =;

static constexpr std::string_view kWellIntendedAutocompleteValuesKeywords[] =;

static constexpr std::string_view
    kNegativeMatchWellIntendedAutocompleteValuesKeywords[] =;

// Returns true iff the `token` is a type hint for a contact field, as
// specified in the implementation section of http://is.gd/whatwg_autocomplete
// Note that "fax" and "pager" are intentionally ignored, as Chrome does not
// support filling either type of information.
bool IsContactTypeHint(const std::string& token) {}

// Returns true iff the `token` is a type hint appropriate for a field of the
// given `field_type`, as specified in the implementation section of
// http://is.gd/whatwg_autocomplete
bool ContactTypeHintMatchesFieldType(const std::string& token,
                                     HtmlFieldType field_type) {}

// Chrome Autofill supports a subset of the field types listed at
// http://is.gd/whatwg_autocomplete. Returns the corresponding HtmlFieldType, if
// `value` matches any of them.
std::optional<HtmlFieldType> ParseStandardizedAutocompleteAttribute(
    std::string_view value) {}

// Maps `value`s that Autofill has proposed for the HTML autocomplete standard,
// but which are not standardized, to their HtmlFieldType.
std::optional<HtmlFieldType> ParseProposedAutocompleteAttribute(
    std::string_view value) {}

// Maps non-standardized `value`s for the HTML autocomplete attribute to an
// HtmlFieldType. This is primarily a list of "reasonable guesses".
std::optional<HtmlFieldType> ParseNonStandarizedAutocompleteAttribute(
    std::string_view value) {}

}  // namespace

std::string AutocompleteParsingResult::ToString() const {}

bool AutocompleteParsingResult::operator==(
    const AutocompleteParsingResult&) const = default;

HtmlFieldType FieldTypeFromAutocompleteAttributeValue(std::string value) {}

std::optional<AutocompleteParsingResult> ParseAutocompleteAttribute(
    std::string_view autocomplete_attribute) {}

bool IsAutocompleteTypeWrongButWellIntended(
    std::string_view autocomplete_attribute) {}

bool ShouldIgnoreAutocompleteAttribute(std::string_view autocomplete) {}

}  // namespace autofill