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