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 <click_elements_before_formfill> or | |
93 // <click_elements_after_formfill>. A new |WebElementDescriptor| object will | |
94 // be appended to |click_elements|. | |
95 void ParseClickElement(std::vector<WebElementDescriptor>* click_elements); | |
96 | |
97 // A helper function to parse a |WebElementDescriptor|. | |
98 // |context| is the current parsing context. | |
99 // |attrs| is the list of attributes (names and values) for the element. | |
100 // |element_descriptor| will be populated by this function. | |
101 WebElementDescriptor* ParseElementDescriptor( | |
102 buzz::XmlParseContext* context, | |
103 const char** attrs, | |
Ilya Sherman
2013/05/23 09:04:42
Please document that |attrs| will be modified by c
benquan
2013/05/24 00:45:11
Nope, the function only changes |attrs| itself (++
| |
104 WebElementDescriptor* element_descriptor); | |
105 | |
92 // A helper function to retrieve integer values from strings. Raises an | 106 // A helper function to retrieve integer values from strings. Raises an |
93 // XML parse error if it fails. | 107 // XML parse error if it fails. |
94 // |context| is the current parsing context. | 108 // |context| is the current parsing context. |
95 // |value| is the string to convert. | 109 // |value| is the string to convert. |
96 int GetIntValue(buzz::XmlParseContext* context, const char* attribute); | 110 int GetIntValue(buzz::XmlParseContext* context, const char* attribute); |
97 | 111 |
98 // The parsed <field type, default value> pairs. | 112 // The parsed <field type, default value> pairs. |
99 std::vector<AutofillServerFieldInfo>* field_infos_; | 113 std::vector<AutofillServerFieldInfo>* field_infos_; |
100 | 114 |
101 // A flag indicating whether the client should upload Autofill data when this | 115 // A flag indicating whether the client should upload Autofill data when this |
102 // form is submitted. | 116 // form is submitted. |
103 UploadRequired* upload_required_; | 117 UploadRequired* upload_required_; |
104 | 118 |
105 // The server experiment to which this query response belongs. | 119 // The server experiment to which this query response belongs. |
106 // For the default server implementation, this is empty. | 120 // For the default server implementation, this is empty. |
107 std::string* experiment_id_; | 121 std::string* experiment_id_; |
108 | 122 |
109 // Page metadata for multipage autofill flow. | 123 // Page metadata for multipage autofill flow. |
110 AutocheckoutPageMetaData* page_meta_data_; | 124 AutocheckoutPageMetaData* page_meta_data_; |
111 | 125 |
126 // The click element the parser is currently processing. | |
127 WebElementDescriptor* current_click_element_; | |
128 | |
112 DISALLOW_COPY_AND_ASSIGN(AutofillQueryXmlParser); | 129 DISALLOW_COPY_AND_ASSIGN(AutofillQueryXmlParser); |
113 }; | 130 }; |
114 | 131 |
115 // The XML parser for handling Autofill upload responses. Typical upload | 132 // The XML parser for handling Autofill upload responses. Typical upload |
116 // responses look like: | 133 // responses look like: |
117 // | 134 // |
118 // <autofilluploadresponse negativeuploadrate="0.00125" positiveuploadrate="1"/> | 135 // <autofilluploadresponse negativeuploadrate="0.00125" positiveuploadrate="1"/> |
119 // | 136 // |
120 // The positive upload rate is the percentage of uploads to send to the server | 137 // 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. | 138 // when something in the users profile matches what they have entered in a form. |
(...skipping 26 matching lines...) Expand all Loading... | |
148 | 165 |
149 double* positive_upload_rate_; | 166 double* positive_upload_rate_; |
150 double* negative_upload_rate_; | 167 double* negative_upload_rate_; |
151 | 168 |
152 DISALLOW_COPY_AND_ASSIGN(AutofillUploadXmlParser); | 169 DISALLOW_COPY_AND_ASSIGN(AutofillUploadXmlParser); |
153 }; | 170 }; |
154 | 171 |
155 } // namespace autofill | 172 } // namespace autofill |
156 | 173 |
157 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_XML_PARSER_H_ | 174 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_XML_PARSER_H_ |
OLD | NEW |