OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "components/autofill/core/common/form_field_data.h" | 11 #include "components/autofill/core/common/form_field_data.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 namespace autofill { | 14 namespace autofill { |
15 | 15 |
16 // Holds information about a form to be filled and/or submitted. | 16 // Holds information about a form to be filled and/or submitted. |
17 struct FormData { | 17 struct FormData { |
18 FormData(); | 18 FormData(); |
19 FormData(const FormData& data); | 19 FormData(const FormData& data); |
20 ~FormData(); | 20 ~FormData(); |
21 | 21 |
22 // Returns true if two forms are the same, not counting the values of the | 22 // Returns true if two forms are the same, not counting the values of the |
23 // form elements. | 23 // form elements. |
24 bool SameFormAs(const FormData& other) const; | 24 bool SameFormAs(const FormData& other) const; |
25 | 25 |
| 26 // Same as SameFormAs() except calling FormFieldData.SimilarFieldAs() to |
| 27 // compare fields. |
| 28 bool SimilarFormAs(const FormData& other) const; |
| 29 |
26 // Note: operator==() performs a full-field-comparison(byte by byte), this is | 30 // Note: operator==() performs a full-field-comparison(byte by byte), this is |
27 // different from SameFormAs(), which ignores comparison for those "values" of | 31 // different from SameFormAs(), which ignores comparison for those "values" of |
28 // all form fields, just like what FormFieldData::SameFieldAs() ignores. | 32 // all form fields, just like what FormFieldData::SameFieldAs() ignores. |
29 bool operator==(const FormData& form) const; | 33 bool operator==(const FormData& form) const; |
30 bool operator!=(const FormData& form) const; | 34 bool operator!=(const FormData& form) const; |
31 // Allow FormData to be a key in STL containers. | 35 // Allow FormData to be a key in STL containers. |
32 bool operator<(const FormData& form) const; | 36 bool operator<(const FormData& form) const; |
33 | 37 |
34 // The name of the form. | 38 // The name of the form. |
35 base::string16 name; | 39 base::string16 name; |
(...skipping 24 matching lines...) Expand all Loading... |
60 // cases we need to store C strings without embedded '\0' symbols. | 64 // cases we need to store C strings without embedded '\0' symbols. |
61 void SerializeFormDataToBase64String(const FormData& form_data, | 65 void SerializeFormDataToBase64String(const FormData& form_data, |
62 std::string* output); | 66 std::string* output); |
63 // Deserialize FormData. Returns true on success. | 67 // Deserialize FormData. Returns true on success. |
64 bool DeserializeFormDataFromBase64String(const base::StringPiece& input, | 68 bool DeserializeFormDataFromBase64String(const base::StringPiece& input, |
65 FormData* form_data); | 69 FormData* form_data); |
66 | 70 |
67 } // namespace autofill | 71 } // namespace autofill |
68 | 72 |
69 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_ | 73 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_FORM_DATA_H_ |
OLD | NEW |