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

Side by Side Diff: chrome/browser/autofill/autofill_xml_parser.h

Issue 11415221: Add support for autofilling radio buttons and checkboxes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed review comments Created 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_AUTOFILL_XML_PARSER_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_XML_PARSER_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_XML_PARSER_H_ 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_XML_PARSER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // <field autofilltype="1" /> 59 // <field autofilltype="1" />
60 // <field autofilltype="3" /> 60 // <field autofilltype="3" />
61 // <field autofilltype="2" /> 61 // <field autofilltype="2" />
62 // </autofillqueryresponse> 62 // </autofillqueryresponse>
63 // 63 //
64 // Fields are returned in the same order they were sent to the server. 64 // Fields are returned in the same order they were sent to the server.
65 // autofilltype: The server's guess at what type of field this is. 0 is 65 // autofilltype: The server's guess at what type of field this is. 0 is
66 // unknown, other types are documented in chrome/browser/autofill/field_types.h. 66 // unknown, other types are documented in chrome/browser/autofill/field_types.h.
67 class AutofillQueryXmlParser : public AutofillXmlParser { 67 class AutofillQueryXmlParser : public AutofillXmlParser {
68 public: 68 public:
69 AutofillQueryXmlParser(std::vector<AutofillFieldType>* field_types, 69 AutofillQueryXmlParser(std::vector<AutofillFieldInfo>* field_infos,
70 UploadRequired* upload_required, 70 UploadRequired* upload_required,
71 std::string* experiment_id); 71 std::string* experiment_id);
72 72
73 private: 73 private:
74 // A callback for the beginning of a new <element>, called by Expat. 74 // A callback for the beginning of a new <element>, called by Expat.
75 // |context| is a parsing context used to resolve element/attribute names. 75 // |context| is a parsing context used to resolve element/attribute names.
76 // |name| is the name of the element. 76 // |name| is the name of the element.
77 // |attrs| is the list of attributes (names and values) for the element. 77 // |attrs| is the list of attributes (names and values) for the element.
78 virtual void StartElement(buzz::XmlParseContext* context, 78 virtual void StartElement(buzz::XmlParseContext* context,
79 const char* name, 79 const char* name,
80 const char** attrs) OVERRIDE; 80 const char** attrs) OVERRIDE;
81 81
82 // A helper function to retrieve integer values from strings. Raises an 82 // A helper function to retrieve integer values from strings. Raises an
83 // XML parse error if it fails. 83 // XML parse error if it fails.
84 // |context| is the current parsing context. 84 // |context| is the current parsing context.
85 // |value| is the string to convert. 85 // |value| is the string to convert.
86 int GetIntValue(buzz::XmlParseContext* context, const char* attribute); 86 int GetIntValue(buzz::XmlParseContext* context, const char* attribute);
87 87
88 // The parsed field types. 88 // The parsed <field type, default value> pairs.
89 std::vector<AutofillFieldType>* field_types_; 89 std::vector<AutofillFieldInfo>* field_infos_;
90 90
91 // A flag indicating whether the client should upload Autofill data when this 91 // A flag indicating whether the client should upload Autofill data when this
92 // form is submitted. 92 // form is submitted.
93 UploadRequired* upload_required_; 93 UploadRequired* upload_required_;
94 94
95 // The server experiment to which this query response belongs. 95 // The server experiment to which this query response belongs.
96 // For the default server implementation, this is empty. 96 // For the default server implementation, this is empty.
97 std::string* experiment_id_; 97 std::string* experiment_id_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(AutofillQueryXmlParser); 99 DISALLOW_COPY_AND_ASSIGN(AutofillQueryXmlParser);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // True if parsing succeeded. 133 // True if parsing succeeded.
134 bool succeeded_; 134 bool succeeded_;
135 135
136 double* positive_upload_rate_; 136 double* positive_upload_rate_;
137 double* negative_upload_rate_; 137 double* negative_upload_rate_;
138 138
139 DISALLOW_COPY_AND_ASSIGN(AutofillUploadXmlParser); 139 DISALLOW_COPY_AND_ASSIGN(AutofillUploadXmlParser);
140 }; 140 };
141 141
142 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_XML_PARSER_H_ 142 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_XML_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698