#include "components/autofill/core/browser/form_parsing/phone_field_parser.h"
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include "base/check.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/form_parsing/autofill_scanner.h"
#include "components/autofill/core/browser/form_parsing/regex_patterns.h"
#include "components/autofill/core/browser/metrics/autofill_metrics.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_regex_constants.h"
#include "components/autofill/core/common/autofill_regexes.h"
namespace autofill {
namespace {
constexpr int kMinSelectOptionsForCountryCode = …;
constexpr int kMaxSelectOptionsForCountryCode = …;
constexpr int kMinCandidatePercentageForCountryCode = …;
constexpr int kHeuristicThresholdForCountryCode = …;
}
PhoneFieldParser::~PhoneFieldParser() = default;
const std::vector<PhoneFieldParser::PhoneGrammar>&
PhoneFieldParser::GetPhoneGrammars() { … }
bool PhoneFieldParser::LikelyAugmentedPhoneCountryCode(
AutofillScanner* scanner,
raw_ptr<AutofillField>* matched_field) { … }
bool PhoneFieldParser::ParseGrammar(ParsingContext& context,
const PhoneGrammar& grammar,
ParsedPhoneFields& parsed_fields,
AutofillScanner* scanner) { … }
std::unique_ptr<FormFieldParser> PhoneFieldParser::Parse(
ParsingContext& context,
AutofillScanner* scanner) { … }
void PhoneFieldParser::AddClassifications(
FieldCandidatesMap& field_candidates) const { … }
PhoneFieldParser::PhoneFieldParser(ParsedPhoneFields fields)
: … { … }
std::string PhoneFieldParser::GetJSONFieldType(RegexType phonetype_id) { … }
bool PhoneFieldParser::ParsePhoneField(ParsingContext& context,
AutofillScanner* scanner,
raw_ptr<AutofillField>* field,
const bool is_country_code_field,
const std::string& json_field_type) { … }
}