OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/scoped_ptr.h" |
| 12 #include "chrome/browser/autofill/autofill_field.h" |
| 13 #include "googleurl/src/gurl.h" |
| 14 |
| 15 namespace webkit_glue { |
| 16 class FormFieldValues; |
| 17 } |
| 18 |
| 19 enum RequestMethod { |
| 20 GET, |
| 21 POST |
| 22 }; |
| 23 |
| 24 // FormStructure stores a single HTML form together with the values entered |
| 25 // in the fields along with additional information needed by AutoFill. |
| 26 class FormStructure { |
| 27 public: |
| 28 explicit FormStructure(const webkit_glue::FormFieldValues& values); |
| 29 |
| 30 // Encodes the XML upload request from this FormStructure. |
| 31 bool EncodeUploadRequest(bool auto_fill_used, std::string* encoded_xml) const; |
| 32 |
| 33 // The unique signature for this form, composed of the target url domain, |
| 34 // the form name, and the form field names in a 64-bit hash. |
| 35 std::string FormSignature() const; |
| 36 |
| 37 // Runs a quick heuristic to rule out pages but obviously not auto-fillable, |
| 38 // like google/yahoo/msn search, etc. |
| 39 bool IsAutoFillable() const; |
| 40 |
| 41 private: |
| 42 // The name of the form. |
| 43 std::string form_name_; |
| 44 |
| 45 // The source URL. |
| 46 GURL source_url_; |
| 47 |
| 48 // The target URL. |
| 49 GURL target_url_; |
| 50 |
| 51 // A vector of all the input fields in the form. |
| 52 std::vector<AutoFillField> fields_; |
| 53 |
| 54 // The names of the form input elements, that are part of the form signature. |
| 55 // The string starts with "&" and the names are also separated by the "&" |
| 56 // character. E.g.: "&form_input1_name&form_input2_name&...&form_inputN_name" |
| 57 std::string form_signature_field_names_; |
| 58 |
| 59 // GET or POST. |
| 60 RequestMethod method_; |
| 61 }; |
| 62 |
| 63 #endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
OLD | NEW |