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

Side by Side Diff: chrome/browser/autofill/autofill_xml_parser.cc

Issue 11539003: Pop up requestAutocomplete UI when autofill server hints chrome client that it is in a multipage au… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated string. Pop the UI only on first page of the flow. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/autofill/autofill_xml_parser.h" 5 #include "chrome/browser/autofill/autofill_xml_parser.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 15 matching lines...) Expand all
26 XML_Error error_code) { 26 XML_Error error_code) {
27 succeeded_ = false; 27 succeeded_ = false;
28 } 28 }
29 29
30 AutofillQueryXmlParser::AutofillQueryXmlParser( 30 AutofillQueryXmlParser::AutofillQueryXmlParser(
31 std::vector<AutofillFieldType>* field_types, 31 std::vector<AutofillFieldType>* field_types,
32 UploadRequired* upload_required, 32 UploadRequired* upload_required,
33 std::string* experiment_id) 33 std::string* experiment_id)
34 : field_types_(field_types), 34 : field_types_(field_types),
35 upload_required_(upload_required), 35 upload_required_(upload_required),
36 page_no_(0), total_pages_(0),
36 experiment_id_(experiment_id) { 37 experiment_id_(experiment_id) {
37 DCHECK(upload_required_); 38 DCHECK(upload_required_);
38 DCHECK(experiment_id_); 39 DCHECK(experiment_id_);
39 } 40 }
40 41
41 void AutofillQueryXmlParser::StartElement(buzz::XmlParseContext* context, 42 void AutofillQueryXmlParser::StartElement(buzz::XmlParseContext* context,
42 const char* name, 43 const char* name,
43 const char** attrs) { 44 const char** attrs) {
44 buzz::QName qname = context->ResolveQName(name, false); 45 buzz::QName qname = context->ResolveQName(name, false);
45 const std::string& element = qname.LocalPart(); 46 const std::string& element = qname.LocalPart();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (attribute_name.compare("autofilltype") == 0) { 83 if (attribute_name.compare("autofilltype") == 0) {
83 int value = GetIntValue(context, attrs[1]); 84 int value = GetIntValue(context, attrs[1]);
84 field_type = static_cast<AutofillFieldType>(value); 85 field_type = static_cast<AutofillFieldType>(value);
85 if (field_type < 0 || field_type > MAX_VALID_FIELD_TYPE) { 86 if (field_type < 0 || field_type > MAX_VALID_FIELD_TYPE) {
86 field_type = NO_SERVER_DATA; 87 field_type = NO_SERVER_DATA;
87 } 88 }
88 } 89 }
89 90
90 // Record this field type. 91 // Record this field type.
91 field_types_->push_back(field_type); 92 field_types_->push_back(field_type);
93 } else if (element.compare("wallet_data") == 0) {
Ilya Sherman 2012/12/13 02:29:23 "wallet_data" does not seem like an appropriate na
Raman Kakilate 2012/12/13 21:34:34 wallet_data is tag that is already added on autofi
Ilya Sherman 2012/12/13 23:23:18 Please rename the tag in the server code. Baking
Raman Kakilate 2013/01/10 00:54:40 Done.
94 // |attrs| is a NULL-terminated list of (attribute, value) pairs.
95 while (*attrs) {
96 buzz::QName attribute_qname = context->ResolveQName(*attrs, true);
97 ++attrs;
98 const std::string& attribute_name = attribute_qname.LocalPart();
99 if (attribute_name.compare("page_no") == 0) {
100 page_no_ = GetIntValue(context, *attrs);
101 } else if (attribute_name.compare("total_pages") == 0) {
102 total_pages_ = GetIntValue(context, *attrs);
103 }
104 ++attrs;
105 }
92 } 106 }
93 } 107 }
94 108
95 int AutofillQueryXmlParser::GetIntValue(buzz::XmlParseContext* context, 109 int AutofillQueryXmlParser::GetIntValue(buzz::XmlParseContext* context,
96 const char* attribute) { 110 const char* attribute) {
97 char* attr_end = NULL; 111 char* attr_end = NULL;
98 int value = strtol(attribute, &attr_end, 10); 112 int value = strtol(attribute, &attr_end, 10);
99 if (attr_end != NULL && attr_end == attribute) { 113 if (attr_end != NULL && attr_end == attribute) {
100 context->RaiseError(XML_ERROR_SYNTAX); 114 context->RaiseError(XML_ERROR_SYNTAX);
101 return 0; 115 return 0;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 double AutofillUploadXmlParser::GetDoubleValue(buzz::XmlParseContext* context, 149 double AutofillUploadXmlParser::GetDoubleValue(buzz::XmlParseContext* context,
136 const char* attribute) { 150 const char* attribute) {
137 char* attr_end = NULL; 151 char* attr_end = NULL;
138 double value = strtod(attribute, &attr_end); 152 double value = strtod(attribute, &attr_end);
139 if (attr_end != NULL && attr_end == attribute) { 153 if (attr_end != NULL && attr_end == attribute) {
140 context->RaiseError(XML_ERROR_SYNTAX); 154 context->RaiseError(XML_ERROR_SYNTAX);
141 return 0.0; 155 return 0.0;
142 } 156 }
143 return value; 157 return value;
144 } 158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698