OLD | NEW |
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_AUTOFILL_XML_PARSER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_XML_PARSER_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_XML_PARSER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_XML_PARSER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 private: | 77 private: |
78 // A callback for the beginning of a new <element>, called by Expat. | 78 // A callback for the beginning of a new <element>, called by Expat. |
79 // |context| is a parsing context used to resolve element/attribute names. | 79 // |context| is a parsing context used to resolve element/attribute names. |
80 // |name| is the name of the element. | 80 // |name| is the name of the element. |
81 // |attrs| is the list of attributes (names and values) for the element. | 81 // |attrs| is the list of attributes (names and values) for the element. |
82 void StartElement(buzz::XmlParseContext* context, | 82 void StartElement(buzz::XmlParseContext* context, |
83 const char* name, | 83 const char* name, |
84 const char** attrs) override; | 84 const char** attrs) override; |
85 | 85 |
86 // A helper function to parse a |WebElementDescriptor|. | |
87 // |context| is the current parsing context. | |
88 // |attrs| is the list of attributes (names and values) for the element. | |
89 // |element_descriptor| will be populated by this function. | |
90 void ParseElementDescriptor(buzz::XmlParseContext* context, | |
91 const char* const* attrs, | |
92 WebElementDescriptor* element_descriptor); | |
93 | |
94 // A helper function to retrieve integer values from strings. Raises an | 86 // A helper function to retrieve integer values from strings. Raises an |
95 // XML parse error if it fails. | 87 // XML parse error if it fails. |
96 // |context| is the current parsing context. | 88 // |context| is the current parsing context. |
97 // |value| is the string to convert. | 89 // |value| is the string to convert. |
98 int GetIntValue(buzz::XmlParseContext* context, const char* attribute); | 90 int GetIntValue(buzz::XmlParseContext* context, const char* attribute); |
99 | 91 |
100 // The parsed <field type, default value> pairs. | 92 // The parsed <field type, default value> pairs. |
101 std::vector<AutofillServerFieldInfo>* field_infos_; | 93 std::vector<AutofillServerFieldInfo>* field_infos_; |
102 | 94 |
103 // A flag indicating whether the client should upload Autofill data when this | 95 // A flag indicating whether the client should upload Autofill data when this |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 135 |
144 double* positive_upload_rate_; | 136 double* positive_upload_rate_; |
145 double* negative_upload_rate_; | 137 double* negative_upload_rate_; |
146 | 138 |
147 DISALLOW_COPY_AND_ASSIGN(AutofillUploadXmlParser); | 139 DISALLOW_COPY_AND_ASSIGN(AutofillUploadXmlParser); |
148 }; | 140 }; |
149 | 141 |
150 } // namespace autofill | 142 } // namespace autofill |
151 | 143 |
152 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_XML_PARSER_H_ | 144 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_XML_PARSER_H_ |
OLD | NEW |