chromium/components/autofill/core/browser/form_structure.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/form_structure.h"

#include <stdint.h>

#include <algorithm>
#include <map>
#include <memory>
#include <optional>
#include <sstream>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "base/base64.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/containers/fixed_flat_map.h"
#include "base/feature_list.h"
#include "base/i18n/case_conversion.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/autofill/core/browser/autofill_data_util.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/field_type_utils.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/form_parsing/buildflags.h"
#include "components/autofill/core/browser/form_parsing/form_field_parser.h"
#include "components/autofill/core/browser/form_processing/label_processing_util.h"
#include "components/autofill/core/browser/form_processing/name_processing_util.h"
#include "components/autofill/core/browser/form_structure_rationalizer.h"
#include "components/autofill/core/browser/form_structure_sectioning_util.h"
#include "components/autofill/core/browser/logging/log_manager.h"
#include "components/autofill/core/browser/metrics/autofill_metrics.h"
#include "components/autofill/core/browser/metrics/autofill_metrics_utils.h"
#include "components/autofill/core/browser/metrics/log_event.h"
#include "components/autofill/core/browser/metrics/shadow_prediction_metrics.h"
#include "components/autofill/core/browser/randomized_encoder.h"
#include "components/autofill/core/browser/server_prediction_overrides.h"
#include "components/autofill/core/browser/validation.h"
#include "components/autofill/core/common/autocomplete_parsing_util.h"
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_internals/log_message.h"
#include "components/autofill/core/common/autofill_internals/logging_scope.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/autofill/core/common/autofill_regex_constants.h"
#include "components/autofill/core/common/autofill_regexes.h"
#include "components/autofill/core/common/autofill_util.h"
#include "components/autofill/core/common/dense_set.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_data_predictions.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/autofill/core/common/form_field_data_predictions.h"
#include "components/autofill/core/common/html_field_types.h"
#include "components/autofill/core/common/logging/log_buffer.h"
#include "components/autofill/core/common/signatures.h"
#include "components/autofill/core/common/unique_ids.h"
#include "components/security_state/core/security_state.h"
#include "components/version_info/version_info.h"
#include "url/origin.h"

namespace autofill {

SubmissionIndicatorEvent;

namespace {

// Returns true if the scheme given by |url| is one for which autofill is
// allowed to activate. By default this only returns true for HTTP and HTTPS.
bool HasAllowedScheme(const GURL& url) {}

std::string ServerTypesToString(const AutofillField* field) {}

}  // namespace

FormStructure::FormStructure(const FormData& form)
    :{}

FormStructure::FormStructure(
    FormSignature form_signature,
    const std::vector<FieldSignature>& field_signatures)
    :{}

FormStructure::~FormStructure() = default;

void FormStructure::DetermineFieldRanks() {}

void FormStructure::DetermineHeuristicTypes(
    const GeoIpCountryCode& client_country,
    AutofillMetrics::FormInteractionsUkmLogger* form_interactions_ukm_logger,
    LogManager* log_manager) {}

void FormStructure::DetermineNonActiveHeuristicTypes(
    std::optional<FieldCandidatesMap> active_predictions,
    ParsingContext& context) {}

// static
std::vector<FormDataPredictions> FormStructure::GetFieldTypePredictions(
    const std::vector<raw_ptr<FormStructure, VectorExperimental>>&
        form_structures) {}

// static
std::vector<FieldGlobalId> FormStructure::FindFieldsEligibleForManualFilling(
    const std::vector<raw_ptr<FormStructure, VectorExperimental>>& forms) {}

std::unique_ptr<FormStructure> FormStructure::CreateForPasswordManagerUpload(
    FormSignature form_signature,
    const std::vector<FieldSignature>& field_signatures) {}

std::string FormStructure::FormSignatureAsStr() const {}

bool FormStructure::IsAutofillable() const {}

bool FormStructure::IsCompleteCreditCardForm() const {}

void FormStructure::UpdateAutofillCount() {}

bool FormStructure::ShouldBeParsed(ShouldBeParsedParams params,
                                   LogManager* log_manager) const {}

bool FormStructure::ShouldRunHeuristics() const {}

bool FormStructure::ShouldRunHeuristicsForSingleFieldForms() const {}

bool FormStructure::ShouldBeQueried() const {}

bool FormStructure::ShouldBeUploaded() const {}

void FormStructure::RetrieveFromCache(const FormStructure& cached_form,
                                      RetrieveFromCacheReason reason) {}

void FormStructure::LogDetermineHeuristicTypesMetrics() {}

void FormStructure::SetFieldTypesFromAutocompleteAttribute() {}

bool FormStructure::SetSectionsFromAutocompleteOrReset() {}

FieldCandidatesMap FormStructure::ParseFieldTypesWithPatterns(
    ParsingContext& context) const {}

void FormStructure::AssignBestFieldTypes(
    const FieldCandidatesMap& field_type_map,
    PatternSource pattern_source) {}

const AutofillField* FormStructure::field(size_t index) const {}

AutofillField* FormStructure::field(size_t index) {}

size_t FormStructure::field_count() const {}

const AutofillField* FormStructure::GetFieldById(FieldGlobalId field_id) const {}

AutofillField* FormStructure::GetFieldById(FieldGlobalId field_id) {}

size_t FormStructure::active_field_count() const {}

bool FormStructure::is_form_element() const {}

FormData FormStructure::ToFormData() const {}

void FormStructure::ProcessExtractedFields() {}

void FormStructure::ExtractParseableFieldLabels() {}

void FormStructure::ExtractParseableFieldNames() {}

DenseSet<FormType> FormStructure::GetFormTypes() const {}

void FormStructure::set_randomized_encoder(
    std::unique_ptr<RandomizedEncoder> encoder) {}

void FormStructure::RationalizePhoneNumbersInSection(const Section& section) {}

void FormStructure::RationalizeFormStructure(
    AutofillMetrics::FormInteractionsUkmLogger* form_interactions_ukm_logger,
    LogManager* log_manager) {}

std::ostream& operator<<(std::ostream& buffer, const FormStructure& form) {}

LogBuffer& operator<<(LogBuffer& buffer, const FormStructure& form) {}

FormDataAndServerPredictions::FormDataAndServerPredictions() = default;

FormDataAndServerPredictions::FormDataAndServerPredictions(
    const FormDataAndServerPredictions&) = default;

FormDataAndServerPredictions& FormDataAndServerPredictions::operator=(
    const FormDataAndServerPredictions&) = default;

FormDataAndServerPredictions::FormDataAndServerPredictions(
    FormDataAndServerPredictions&&) = default;

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

FormDataAndServerPredictions::~FormDataAndServerPredictions() = default;

FormDataAndServerPredictions GetFormDataAndServerPredictions(
    const FormStructure& form) {}

}  // namespace autofill