| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ | 6 #define CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/scoped_vector.h" | 12 #include "base/scoped_vector.h" |
| 13 #include "chrome/browser/autofill/autofill_field.h" | 13 #include "chrome/browser/autofill/autofill_field.h" |
| 14 #include "chrome/browser/autofill/autofill_metrics.h" |
| 14 #include "chrome/browser/autofill/autofill_type.h" | 15 #include "chrome/browser/autofill/autofill_type.h" |
| 15 #include "chrome/browser/autofill/field_types.h" | 16 #include "chrome/browser/autofill/field_types.h" |
| 16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 17 #include "webkit/glue/form_data.h" | 18 #include "webkit/glue/form_data.h" |
| 18 | 19 |
| 19 namespace buzz { | 20 namespace buzz { |
| 20 class XmlElement; | 21 class XmlElement; |
| 21 } // namespace buzz | 22 } // namespace buzz |
| 22 | 23 |
| 23 enum RequestMethod { | 24 enum RequestMethod { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 46 // All fields are returned in one XML. For example, there are three forms, | 47 // All fields are returned in one XML. For example, there are three forms, |
| 47 // with 2, 4, and 3 fields. The returned XML would have type info for 9 | 48 // with 2, 4, and 3 fields. The returned XML would have type info for 9 |
| 48 // fields, first two of which would be for the first form, next 4 for the | 49 // fields, first two of which would be for the first form, next 4 for the |
| 49 // second, and the rest is for the third. | 50 // second, and the rest is for the third. |
| 50 static bool EncodeQueryRequest(const ScopedVector<FormStructure>& forms, | 51 static bool EncodeQueryRequest(const ScopedVector<FormStructure>& forms, |
| 51 std::vector<std::string>* encoded_signatures, | 52 std::vector<std::string>* encoded_signatures, |
| 52 std::string* encoded_xml); | 53 std::string* encoded_xml); |
| 53 | 54 |
| 54 // Parses the field types from the server query response. |forms| must be the | 55 // Parses the field types from the server query response. |forms| must be the |
| 55 // same as the one passed to EncodeQueryRequest when constructing the query. | 56 // same as the one passed to EncodeQueryRequest when constructing the query. |
| 56 static void ParseQueryResponse(const std::string& response_xml, | 57 static void ParseQueryResponse( |
| 57 const std::vector<FormStructure*>& forms, | 58 const std::string& response_xml, |
| 58 UploadRequired* upload_required); | 59 const std::vector<FormStructure*>& forms, |
| 60 UploadRequired* upload_required, |
| 61 autofill_metrics::LogServerQueryMetricFn log_server_query_metric); |
| 59 | 62 |
| 60 // The unique signature for this form, composed of the target url domain, | 63 // The unique signature for this form, composed of the target url domain, |
| 61 // the form name, and the form field names in a 64-bit hash. | 64 // the form name, and the form field names in a 64-bit hash. |
| 62 std::string FormSignature() const; | 65 std::string FormSignature() const; |
| 63 | 66 |
| 64 // Runs a quick heuristic to rule out forms that are obviously not | 67 // Runs a quick heuristic to rule out forms that are obviously not |
| 65 // auto-fillable, like google/yahoo/msn search, etc. The requirement that the | 68 // auto-fillable, like google/yahoo/msn search, etc. The requirement that the |
| 66 // form's method be POST is only applied if |require_method_post| is true. | 69 // form's method be POST is only applied if |require_method_post| is true. |
| 67 bool IsAutoFillable(bool require_method_post) const; | 70 bool IsAutoFillable(bool require_method_post) const; |
| 68 | 71 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // character. E.g.: "&form_input1_name&form_input2_name&...&form_inputN_name" | 149 // character. E.g.: "&form_input1_name&form_input2_name&...&form_inputN_name" |
| 147 std::string form_signature_field_names_; | 150 std::string form_signature_field_names_; |
| 148 | 151 |
| 149 // GET or POST. | 152 // GET or POST. |
| 150 RequestMethod method_; | 153 RequestMethod method_; |
| 151 | 154 |
| 152 DISALLOW_COPY_AND_ASSIGN(FormStructure); | 155 DISALLOW_COPY_AND_ASSIGN(FormStructure); |
| 153 }; | 156 }; |
| 154 | 157 |
| 155 #endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ | 158 #endif // CHROME_BROWSER_AUTOFILL_FORM_STRUCTURE_H_ |
| OLD | NEW |