diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index a3f09721c3499..86d16c3a842b6 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc @@ -1596,7 +1596,7 @@ void FormStructure::RationalizeStreetAddressAndAddressLine( } void FormStructure::RationalizePhoneNumbersInSection(const Section& section) { - if (phone_rationalized_[section]) + if (base::Contains(phone_rationalized_, section)) return; std::vector fields; for (size_t i = 0; i < field_count(); ++i) { @@ -1605,7 +1605,7 @@ void FormStructure::RationalizePhoneNumbersInSection(const Section& section) { fields.push_back(field(i)); } rationalization_util::RationalizePhoneNumberFields(fields); - phone_rationalized_[section] = true; + phone_rationalized_.insert(section); } void FormStructure::ApplyRationalizationsToFieldAndLog( diff --git a/components/autofill/core/browser/form_structure.h b/components/autofill/core/browser/form_structure.h index f7e60834d7a7a..1c0859df4e698 100644 --- a/components/autofill/core/browser/form_structure.h +++ b/components/autofill/core/browser/form_structure.h @@ -7,7 +7,6 @@ #include -#include #include #include #include @@ -669,7 +668,7 @@ class FormStructure { base::TimeTicks form_parsed_timestamp_; // If phone number rationalization has been performed for a given section. - std::map phone_rationalized_; + std::set
phone_rationalized_; // True iff the form is a password form and the user has seen the password // value before accepting the prompt to save. Used for crowdsourcing. diff --git a/components/autofill/core/browser/form_structure_test_api.h b/components/autofill/core/browser/form_structure_test_api.h index 940547d752d25..eeca25c1f6a6d 100644 --- a/components/autofill/core/browser/form_structure_test_api.h +++ b/components/autofill/core/browser/form_structure_test_api.h @@ -7,6 +7,7 @@ #include +#include "base/containers/contains.h" #include "base/memory/raw_ptr.h" #include "base/strings/string_piece.h" #include "components/autofill/core/browser/form_structure.h" @@ -67,8 +68,7 @@ class FormStructureTestApi { } bool phone_rationalized(const Section& section) const { - auto it = form_structure_->phone_rationalized_.find(section); - return it != form_structure_->phone_rationalized_.end() && it->second; + return base::Contains(form_structure_->phone_rationalized_, section); } void ParseFieldTypesWithPatterns(PatternSource pattern_source) {