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 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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<AutofillFieldType>* field_types, |
70 UploadRequired* upload_required, | 70 UploadRequired* upload_required, |
71 std::string* experiment_id); | 71 std::string* experiment_id); |
72 | 72 |
73 int page_number() { return page_number_; } | |
ahutter
2012/12/17 17:35:39
int page_number() const {...
Raman Kakilate
2013/01/10 00:54:40
Done.
| |
74 | |
75 int total_pages() { return total_pages_; } | |
76 | |
73 private: | 77 private: |
74 // 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. |
75 // |context| is a parsing context used to resolve element/attribute names. | 79 // |context| is a parsing context used to resolve element/attribute names. |
76 // |name| is the name of the element. | 80 // |name| is the name of the element. |
77 // |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. |
78 virtual void StartElement(buzz::XmlParseContext* context, | 82 virtual void StartElement(buzz::XmlParseContext* context, |
79 const char* name, | 83 const char* name, |
80 const char** attrs) OVERRIDE; | 84 const char** attrs) OVERRIDE; |
81 | 85 |
82 // A helper function to retrieve integer values from strings. Raises an | 86 // A helper function to retrieve integer values from strings. Raises an |
83 // XML parse error if it fails. | 87 // XML parse error if it fails. |
84 // |context| is the current parsing context. | 88 // |context| is the current parsing context. |
85 // |value| is the string to convert. | 89 // |value| is the string to convert. |
86 int GetIntValue(buzz::XmlParseContext* context, const char* attribute); | 90 int GetIntValue(buzz::XmlParseContext* context, const char* attribute); |
87 | 91 |
88 // The parsed field types. | 92 // The parsed field types. |
89 std::vector<AutofillFieldType>* field_types_; | 93 std::vector<AutofillFieldType>* field_types_; |
90 | 94 |
91 // 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 |
92 // form is submitted. | 96 // form is submitted. |
93 UploadRequired* upload_required_; | 97 UploadRequired* upload_required_; |
94 | 98 |
99 // Page number of present page in multipage autofill flow. | |
100 int page_number_; | |
101 | |
102 // Total number of pages in multipage autofill flow. | |
103 int total_pages_; | |
104 | |
95 // The server experiment to which this query response belongs. | 105 // The server experiment to which this query response belongs. |
96 // For the default server implementation, this is empty. | 106 // For the default server implementation, this is empty. |
97 std::string* experiment_id_; | 107 std::string* experiment_id_; |
98 | 108 |
99 DISALLOW_COPY_AND_ASSIGN(AutofillQueryXmlParser); | 109 DISALLOW_COPY_AND_ASSIGN(AutofillQueryXmlParser); |
100 }; | 110 }; |
101 | 111 |
102 // The XML parser for handling Autofill upload responses. Typical upload | 112 // The XML parser for handling Autofill upload responses. Typical upload |
103 // responses look like: | 113 // responses look like: |
104 // | 114 // |
(...skipping 28 matching lines...) Expand all Loading... | |
133 // True if parsing succeeded. | 143 // True if parsing succeeded. |
134 bool succeeded_; | 144 bool succeeded_; |
135 | 145 |
136 double* positive_upload_rate_; | 146 double* positive_upload_rate_; |
137 double* negative_upload_rate_; | 147 double* negative_upload_rate_; |
138 | 148 |
139 DISALLOW_COPY_AND_ASSIGN(AutofillUploadXmlParser); | 149 DISALLOW_COPY_AND_ASSIGN(AutofillUploadXmlParser); |
140 }; | 150 }; |
141 | 151 |
142 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_XML_PARSER_H_ | 152 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_XML_PARSER_H_ |
OLD | NEW |