Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: components/autofill/core/browser/form_structure.h

Issue 1477733003: Replace xmllite with libxml in autofill (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@556433_remove_dead_code
Patch Set: Just rebased Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_BROWSER_FORM_STRUCTURE_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "components/autofill/core/browser/autofill_field.h" 17 #include "components/autofill/core/browser/autofill_field.h"
18 #include "components/autofill/core/browser/autofill_type.h" 18 #include "components/autofill/core/browser/autofill_type.h"
19 #include "components/autofill/core/browser/field_types.h" 19 #include "components/autofill/core/browser/field_types.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 21
22 class XmlWriter;
23
22 enum UploadRequired { 24 enum UploadRequired {
23 UPLOAD_NOT_REQUIRED, 25 UPLOAD_NOT_REQUIRED,
24 UPLOAD_REQUIRED, 26 UPLOAD_REQUIRED,
25 USE_UPLOAD_RATES 27 USE_UPLOAD_RATES
26 }; 28 };
27 29
28 namespace base { 30 namespace base {
29 class TimeTicks; 31 class TimeTicks;
30 } 32 }
31 33
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // example, there are three valid forms, with 2, 4, and 3 fields. The returned 77 // example, there are three valid forms, with 2, 4, and 3 fields. The returned
76 // XML would have type info for 9 fields, first two of which would be for the 78 // XML would have type info for 9 fields, first two of which would be for the
77 // first form, next 4 for the second, and the rest is for the third. 79 // first form, next 4 for the second, and the rest is for the third.
78 static bool EncodeQueryRequest(const std::vector<FormStructure*>& forms, 80 static bool EncodeQueryRequest(const std::vector<FormStructure*>& forms,
79 std::vector<std::string>* encoded_signatures, 81 std::vector<std::string>* encoded_signatures,
80 std::string* encoded_xml); 82 std::string* encoded_xml);
81 83
82 // Parses the field types from the server query response. |forms| must be the 84 // Parses the field types from the server query response. |forms| must be the
83 // same as the one passed to EncodeQueryRequest when constructing the query. 85 // same as the one passed to EncodeQueryRequest when constructing the query.
84 // |rappor_service| may be null. 86 // |rappor_service| may be null.
85 static void ParseQueryResponse(const std::string& response_xml, 87 static void ParseQueryResponse(std::string response_xml,
86 const std::vector<FormStructure*>& forms, 88 const std::vector<FormStructure*>& forms,
87 rappor::RapporService* rappor_service); 89 rappor::RapporService* rappor_service);
88 90
89 // Returns predictions using the details from the given |form_structures| and 91 // Returns predictions using the details from the given |form_structures| and
90 // their fields' predicted types. 92 // their fields' predicted types.
91 static std::vector<FormDataPredictions> GetFieldTypePredictions( 93 static std::vector<FormDataPredictions> GetFieldTypePredictions(
92 const std::vector<FormStructure*>& form_structures); 94 const std::vector<FormStructure*>& form_structures);
93 95
94 // The unique signature for this form, composed of the target url domain, 96 // The unique signature for this form, composed of the target url domain,
95 // the form name, and the form field names in a 64-bit hash. 97 // the form name, and the form field names in a 64-bit hash.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 217
216 // 64-bit hash of the string - used in FormSignature and unit-tests. 218 // 64-bit hash of the string - used in FormSignature and unit-tests.
217 static std::string Hash64Bit(const std::string& str); 219 static std::string Hash64Bit(const std::string& str);
218 220
219 enum EncodeRequestType { 221 enum EncodeRequestType {
220 QUERY, 222 QUERY,
221 UPLOAD, 223 UPLOAD,
222 FIELD_ASSIGNMENTS, 224 FIELD_ASSIGNMENTS,
223 }; 225 };
224 226
225 // Adds form info to |encompassing_xml_element|. |request_type| indicates if 227 // Returns true if the form has no fields, or too many.
226 // it is a query or upload. 228 bool IsMalformed() const;
229
230 // Takes |xml_writer| and writes description for |fields_|, according to
231 // |request_type|. Returns false on failure, including when there are no
232 // fields, and true on success.
227 bool EncodeFormRequest(EncodeRequestType request_type, 233 bool EncodeFormRequest(EncodeRequestType request_type,
228 buzz::XmlElement* encompassing_xml_element) const; 234 XmlWriter* xml_writer) const;
229 235
230 // Classifies each field in |fields_| into a logical section. 236 // Classifies each field in |fields_| into a logical section.
231 // Sections are identified by the heuristic that a logical section should not 237 // Sections are identified by the heuristic that a logical section should not
232 // include multiple fields of the same autofill type (with some exceptions, as 238 // include multiple fields of the same autofill type (with some exceptions, as
233 // described in the implementation). Sections are furthermore distinguished 239 // described in the implementation). Sections are furthermore distinguished
234 // as either credit card or non-credit card sections. 240 // as either credit card or non-credit card sections.
235 // If |has_author_specified_sections| is true, only the second pass -- 241 // If |has_author_specified_sections| is true, only the second pass --
236 // distinguishing credit card sections from non-credit card ones -- is made. 242 // distinguishing credit card sections from non-credit card ones -- is made.
237 void IdentifySections(bool has_author_specified_sections); 243 void IdentifySections(bool has_author_specified_sections);
238 244
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 291
286 // True if the form is a <form>. 292 // True if the form is a <form>.
287 bool is_form_tag_; 293 bool is_form_tag_;
288 294
289 DISALLOW_COPY_AND_ASSIGN(FormStructure); 295 DISALLOW_COPY_AND_ASSIGN(FormStructure);
290 }; 296 };
291 297
292 } // namespace autofill 298 } // namespace autofill
293 299
294 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ 300 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_xml_parser_unittest.cc ('k') | components/autofill/core/browser/form_structure.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698