summaryrefslogtreecommitdiff
path: root/chromium/components/autofill/core/common/form_data.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-03-11 11:32:04 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-03-18 13:40:17 +0000
commit31ccca0778db85c159634478b4ec7997f6704860 (patch)
tree3d33fc3afd9d5ec95541e1bbe074a9cf8da12a0e /chromium/components/autofill/core/common/form_data.h
parent248b70b82a40964d5594eb04feca0fa36716185d (diff)
downloadqtwebengine-chromium-31ccca0778db85c159634478b4ec7997f6704860.tar.gz
BASELINE: Update Chromium to 80.0.3987.136
Change-Id: I98e1649aafae85ba3a83e67af00bb27ef301db7b Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'chromium/components/autofill/core/common/form_data.h')
-rw-r--r--chromium/components/autofill/core/common/form_data.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/chromium/components/autofill/core/common/form_data.h b/chromium/components/autofill/core/common/form_data.h
index 932394bc09e..1e84cec2998 100644
--- a/chromium/components/autofill/core/common/form_data.h
+++ b/chromium/components/autofill/core/common/form_data.h
@@ -29,6 +29,12 @@ using ButtonTitleList = std::vector<ButtonTitleInfo>;
// Holds information about a form to be filled and/or submitted.
struct FormData {
+ // Less-than relation for STL containers. Compares only members needed to
+ // uniquely identify a form.
+ struct IdentityComparator {
+ bool operator()(const FormData& a, const FormData& b) const;
+ };
+
// TODO(https://crbug.com/875768): Rename this const to kNotSetRendererId, and
// use it also for not set renderer ids in FormFieldData.
static constexpr uint32_t kNotSetFormRendererId =
@@ -52,11 +58,6 @@ struct FormData {
// If |form| is the same as this from the POV of dynamic refills.
bool DynamicallySameFormAs(const FormData& form) const;
- // Note: operator==() performs a full-field-comparison(byte by byte), this is
- // different from SameFormAs(), which ignores comparison for those "values" of
- // all form fields, just like what FormFieldData::SameFieldAs() ignores.
- bool operator==(const FormData& form) const;
- bool operator!=(const FormData& form) const;
// Allow FormData to be a key in STL containers.
bool operator<(const FormData& form) const;
@@ -66,6 +67,11 @@ struct FormData {
// The name attribute of the form.
base::string16 name_attribute;
+ // NOTE: update IdentityComparator when adding new a member.
+ // NOTE: update SameFormAs() if needed when adding new a member.
+ // NOTE: update SimilarFormAs() if needed when adding new a member.
+ // NOTE: update DynamicallySameFormAs() if needed when adding new a member.
+
// The name by which autofill knows this form. This is generally either the
// name attribute or the id_attribute value, which-ever is non-empty with
// priority given to the name_attribute. This value is used when computing
@@ -91,9 +97,9 @@ struct FormData {
// and used if features::kAutofillRestrictUnownedFieldsToFormlessCheckout is
// enabled, to prevent heuristics from running on formless non-checkout.
bool is_formless_checkout = false;
- // Unique renderer id which is returned by function
- // WebFormElement::UniqueRendererFormId(). It is not persistant between page
- // loads, so it is not saved and not used in comparison in SameFormAs().
+ // Unique renderer id returned by WebFormElement::UniqueRendererFormId(). It
+ // is not persistent between page loads, so it is not saved and not used in
+ // comparison in SameFormAs().
uint32_t unique_renderer_id = kNotSetFormRendererId;
// The type of the event that was taken as an indication that this form is
// being or has already been submitted. This field is filled only in Password
@@ -124,6 +130,8 @@ bool DeserializeFormData(base::PickleIterator* iter, FormData* form_data);
LogBuffer& operator<<(LogBuffer& buffer, const FormData& form);
+bool FormDataEqualForTesting(const FormData& lhs, const FormData& rhs);
+
} // namespace autofill
#endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_