Chromium Code Reviews| Index: chrome/browser/autofill/autofill_xml_parser.cc |
| diff --git a/chrome/browser/autofill/autofill_xml_parser.cc b/chrome/browser/autofill/autofill_xml_parser.cc |
| index 92a1ede91c0f94dbc96794d4060b2c51af488145..c9f8507d3a84e6daa406b15d5c9a3347087646b9 100644 |
| --- a/chrome/browser/autofill/autofill_xml_parser.cc |
| +++ b/chrome/browser/autofill/autofill_xml_parser.cc |
| @@ -28,10 +28,10 @@ void AutofillXmlParser::Error(buzz::XmlParseContext* context, |
| } |
| AutofillQueryXmlParser::AutofillQueryXmlParser( |
| - std::vector<AutofillFieldType>* field_types, |
| + std::vector<AutofillFieldInfo>* field_infos, |
| UploadRequired* upload_required, |
| std::string* experiment_id) |
| - : field_types_(field_types), |
| + : field_infos_(field_infos), |
| upload_required_(upload_required), |
| experiment_id_(experiment_id) { |
| DCHECK(upload_required_); |
| @@ -78,6 +78,7 @@ void AutofillQueryXmlParser::StartElement(buzz::XmlParseContext* context, |
| AutofillFieldType field_type = UNKNOWN_TYPE; |
| buzz::QName attribute_qname = context->ResolveQName(attrs[0], true); |
| const std::string& attribute_name = attribute_qname.LocalPart(); |
| + std::string default_value; |
| if (attribute_name.compare("autofilltype") == 0) { |
| int value = GetIntValue(context, attrs[1]); |
| @@ -87,8 +88,17 @@ void AutofillQueryXmlParser::StartElement(buzz::XmlParseContext* context, |
| } |
| } |
| - // Record this field type. |
| - field_types_->push_back(field_type); |
| + // If default value is specified in the response, extract it. |
| + if (field_type == FIELD_WITH_DEFAULT_VALUE && attrs[2]) { |
|
Albert Bodenhamer
2012/11/30 19:01:08
As the list of attributes gets longer the magic nu
Raman Kakilate
2012/11/30 22:36:53
ATTRIBUTE_1_NAME, ATTRIBUTE_1_VALUE, ATTRIBUTE_2_N
Ilya Sherman
2012/12/01 00:54:12
How about names like ATTRIBUTE_NAME_DEFAULT_FIELD_
Raman Kakilate
2012/12/06 01:54:05
changed the implementation to loop over attribute
|
| + buzz::QName attrib_qname = context->ResolveQName(attrs[2], true); |
| + const std::string& attrib = attrib_qname.LocalPart(); |
| + if (attrib.compare("defaultvalue") == 0) { |
| + default_value.assign(attrs[3]); |
| + } |
| + } |
| + |
| + // Record this field type, default value pair. |
| + field_infos_->push_back(AutofillFieldInfo(field_type, default_value)); |
| } |
| } |