OLD | NEW |
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 COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_XML_PARSER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_XML_PARSER_H_ |
6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_XML_PARSER_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_XML_PARSER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 private: | 83 private: |
84 // A callback for the beginning of a new <element>, called by Expat. | 84 // A callback for the beginning of a new <element>, called by Expat. |
85 // |context| is a parsing context used to resolve element/attribute names. | 85 // |context| is a parsing context used to resolve element/attribute names. |
86 // |name| is the name of the element. | 86 // |name| is the name of the element. |
87 // |attrs| is the list of attributes (names and values) for the element. | 87 // |attrs| is the list of attributes (names and values) for the element. |
88 virtual void StartElement(buzz::XmlParseContext* context, | 88 virtual void StartElement(buzz::XmlParseContext* context, |
89 const char* name, | 89 const char* name, |
90 const char** attrs) OVERRIDE; | 90 const char** attrs) OVERRIDE; |
91 | 91 |
| 92 // A helper function to parse a |WebElementDescriptor|. |
| 93 // |context| is the current parsing context. |
| 94 // |attrs| is the list of attributes (names and values) for the element. |
| 95 // |element_descriptor| will be populated by this function. |
| 96 void ParseElementDescriptor(buzz::XmlParseContext* context, |
| 97 const char* const* attrs, |
| 98 WebElementDescriptor* element_descriptor); |
| 99 |
92 // A helper function to retrieve integer values from strings. Raises an | 100 // A helper function to retrieve integer values from strings. Raises an |
93 // XML parse error if it fails. | 101 // XML parse error if it fails. |
94 // |context| is the current parsing context. | 102 // |context| is the current parsing context. |
95 // |value| is the string to convert. | 103 // |value| is the string to convert. |
96 int GetIntValue(buzz::XmlParseContext* context, const char* attribute); | 104 int GetIntValue(buzz::XmlParseContext* context, const char* attribute); |
97 | 105 |
98 // The parsed <field type, default value> pairs. | 106 // The parsed <field type, default value> pairs. |
99 std::vector<AutofillServerFieldInfo>* field_infos_; | 107 std::vector<AutofillServerFieldInfo>* field_infos_; |
100 | 108 |
101 // A flag indicating whether the client should upload Autofill data when this | 109 // A flag indicating whether the client should upload Autofill data when this |
102 // form is submitted. | 110 // form is submitted. |
103 UploadRequired* upload_required_; | 111 UploadRequired* upload_required_; |
104 | 112 |
105 // The server experiment to which this query response belongs. | 113 // The server experiment to which this query response belongs. |
106 // For the default server implementation, this is empty. | 114 // For the default server implementation, this is empty. |
107 std::string* experiment_id_; | 115 std::string* experiment_id_; |
108 | 116 |
109 // Page metadata for multipage autofill flow. | 117 // Page metadata for multipage autofill flow. |
110 AutocheckoutPageMetaData* page_meta_data_; | 118 AutocheckoutPageMetaData* page_meta_data_; |
111 | 119 |
| 120 // The click element the parser is currently processing. |
| 121 WebElementDescriptor* current_click_element_; |
| 122 |
112 DISALLOW_COPY_AND_ASSIGN(AutofillQueryXmlParser); | 123 DISALLOW_COPY_AND_ASSIGN(AutofillQueryXmlParser); |
113 }; | 124 }; |
114 | 125 |
115 // The XML parser for handling Autofill upload responses. Typical upload | 126 // The XML parser for handling Autofill upload responses. Typical upload |
116 // responses look like: | 127 // responses look like: |
117 // | 128 // |
118 // <autofilluploadresponse negativeuploadrate="0.00125" positiveuploadrate="1"/> | 129 // <autofilluploadresponse negativeuploadrate="0.00125" positiveuploadrate="1"/> |
119 // | 130 // |
120 // The positive upload rate is the percentage of uploads to send to the server | 131 // The positive upload rate is the percentage of uploads to send to the server |
121 // when something in the users profile matches what they have entered in a form. | 132 // when something in the users profile matches what they have entered in a form. |
(...skipping 26 matching lines...) Expand all Loading... |
148 | 159 |
149 double* positive_upload_rate_; | 160 double* positive_upload_rate_; |
150 double* negative_upload_rate_; | 161 double* negative_upload_rate_; |
151 | 162 |
152 DISALLOW_COPY_AND_ASSIGN(AutofillUploadXmlParser); | 163 DISALLOW_COPY_AND_ASSIGN(AutofillUploadXmlParser); |
153 }; | 164 }; |
154 | 165 |
155 } // namespace autofill | 166 } // namespace autofill |
156 | 167 |
157 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_XML_PARSER_H_ | 168 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_XML_PARSER_H_ |
OLD | NEW |