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

Unified Diff: chrome/browser/autofill/autofill_xml_parser.cc

Issue 11415221: Add support for autofilling radio buttons and checkboxes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix lint errors Created 8 years 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 side-by-side diff with in-line comments
Download patch
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..7dae2e56e75a7b75ef86cd041fd71791be53fc5a 100644
--- a/chrome/browser/autofill/autofill_xml_parser.cc
+++ b/chrome/browser/autofill/autofill_xml_parser.cc
@@ -8,6 +8,7 @@
#include <string.h>
#include "base/logging.h"
+#include "chrome/browser/autofill/autofill_server_field_info.h"
#include "third_party/libjingle/source/talk/xmllite/qname.h"
AutofillXmlParser::AutofillXmlParser()
@@ -28,10 +29,10 @@ void AutofillXmlParser::Error(buzz::XmlParseContext* context,
}
AutofillQueryXmlParser::AutofillQueryXmlParser(
- std::vector<AutofillFieldType>* field_types,
+ std::vector<AutofillServerFieldInfo>* 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_);
@@ -75,20 +76,28 @@ void AutofillQueryXmlParser::StartElement(buzz::XmlParseContext* context,
// Determine the field type from the attribute value. There should be one
// attribute (autofilltype) with an integer value.
- AutofillFieldType field_type = UNKNOWN_TYPE;
- buzz::QName attribute_qname = context->ResolveQName(attrs[0], true);
- const std::string& attribute_name = attribute_qname.LocalPart();
-
- if (attribute_name.compare("autofilltype") == 0) {
- int value = GetIntValue(context, attrs[1]);
- field_type = static_cast<AutofillFieldType>(value);
- if (field_type < 0 || field_type > MAX_VALID_FIELD_TYPE) {
- field_type = NO_SERVER_DATA;
+ AutofillServerFieldInfo field_info;
+ field_info.field_type = UNKNOWN_TYPE;
+
+ while (*attrs) {
+ buzz::QName attribute_qname = context->ResolveQName(attrs[0], true);
+ const std::string& attribute_name = attribute_qname.LocalPart();
+ if (attribute_name.compare("autofilltype") == 0) {
+ int value = GetIntValue(context, attrs[1]);
+ field_info.field_type = static_cast<AutofillFieldType>(value);
+ if (field_info.field_type < 0 ||
+ field_info.field_type > MAX_VALID_FIELD_TYPE)
+ field_info.field_type = NO_SERVER_DATA;
+ } else if (field_info.field_type == FIELD_WITH_DEFAULT_VALUE &&
+ attribute_name.compare("defaultvalue") == 0) {
+ field_info.default_value.assign(attrs[1]);
}
+
+ attrs +=2;
Albert Bodenhamer 2012/12/06 17:39:05 This is awkward. If you're going to do C-style po
Raman Kakilate 2012/12/06 18:06:35 I was trying to be consistent with lines 55-69. I
Albert Bodenhamer 2012/12/06 23:15:45 I was thinking more like: while (*attrs) {
}
- // Record this field type.
- field_types_->push_back(field_type);
+ // Record this field type, default value pair.
+ field_infos_->push_back(field_info);
}
}
« no previous file with comments | « chrome/browser/autofill/autofill_xml_parser.h ('k') | chrome/browser/autofill/autofill_xml_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698