Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: components/autofill/browser/autofill_xml_parser.h

Issue 15487004: Autocheckout: parse multiple clicks setting in autofill response. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address Ilya's comments. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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);
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* const* attrs,
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698