diff options
Diffstat (limited to 'chrome/browser/autofill/form_structure.h')
-rw-r--r-- | chrome/browser/autofill/form_structure.h | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/chrome/browser/autofill/form_structure.h b/chrome/browser/autofill/form_structure.h index 3802aed..bb20885 100644 --- a/chrome/browser/autofill/form_structure.h +++ b/chrome/browser/autofill/form_structure.h @@ -14,10 +14,14 @@ #include "chrome/browser/autofill/field_types.h" #include "googleurl/src/gurl.h" +namespace buzz { + class XmlElement; +} // namespace buzz + namespace webkit_glue { struct FormData; class FormFieldValues; -} +} // namespace webkit_glue enum RequestMethod { GET, @@ -36,11 +40,18 @@ class FormStructure { public: explicit FormStructure(const webkit_glue::FormFieldValues& values); - // Encodes the XML query or upload request from this FormStructure. - // |query| - true means request is a query, upload otherwise. - bool EncodeUploadRequest(bool auto_fill_used, bool query, + // Encodes the XML upload request from this FormStructure. + bool EncodeUploadRequest(bool auto_fill_used, std::string* encoded_xml) const; + // Encodes the XML query request for the set of forms. + // All fields are returned in one XML. For example, there are three forms, + // with 2, 4, and 3 fields. The returned XML would have type info for 9 + // fields, first two of which would be for the first form, next 4 for the + // second, and the rest is for the third. + static bool EncodeQueryRequest(const ScopedVector<FormStructure>& forms, + std::string* encoded_xml); + // Runs several heuristics against the form fields to determine their possible // types. void GetHeuristicAutoFillTypes(); @@ -71,9 +82,19 @@ class FormStructure { bool operator!=(const webkit_glue::FormData& form) const; private: + enum EncodeRequestType { + QUERY, + UPLOAD, + }; + // Associates the field with the heuristic type for each of the field views. void GetHeuristicFieldInfo(FieldTypeMap* field_types_map); + // Adds form info to |encompassing_xml_element|. |request_type| indicates if + // it is a query or upload. + bool EncodeFormRequest(EncodeRequestType request_type, + buzz::XmlElement* encompassing_xml_element) const; + // The name of the form. // TODO(jhawkins): string16 std::string form_name_; |