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

Side by Side Diff: components/autofill/core/browser/autofill_xml_parser.cc

Issue 22009003: [Autofill] Distinguish between native field types and potentially HTML field types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/autofill_xml_parser.h" 5 #include "components/autofill/core/browser/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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 field_info.field_type = UNKNOWN_TYPE; 93 field_info.field_type = UNKNOWN_TYPE;
94 94
95 // |attrs| is a NULL-terminated list of (attribute, value) pairs. 95 // |attrs| is a NULL-terminated list of (attribute, value) pairs.
96 while (*attrs) { 96 while (*attrs) {
97 buzz::QName attribute_qname = context->ResolveQName(*attrs, true); 97 buzz::QName attribute_qname = context->ResolveQName(*attrs, true);
98 ++attrs; 98 ++attrs;
99 const std::string& attribute_name = attribute_qname.LocalPart(); 99 const std::string& attribute_name = attribute_qname.LocalPart();
100 if (attribute_name.compare("autofilltype") == 0) { 100 if (attribute_name.compare("autofilltype") == 0) {
101 int value = GetIntValue(context, *attrs); 101 int value = GetIntValue(context, *attrs);
102 if (value >= 0 && value < MAX_VALID_FIELD_TYPE) 102 if (value >= 0 && value < MAX_VALID_FIELD_TYPE)
103 field_info.field_type = static_cast<AutofillFieldType>(value); 103 field_info.field_type = static_cast<ServerFieldType>(value);
104 else 104 else
105 field_info.field_type = NO_SERVER_DATA; 105 field_info.field_type = NO_SERVER_DATA;
106 } else if (field_info.field_type == FIELD_WITH_DEFAULT_VALUE && 106 } else if (field_info.field_type == FIELD_WITH_DEFAULT_VALUE &&
107 attribute_name.compare("defaultvalue") == 0) { 107 attribute_name.compare("defaultvalue") == 0) {
108 field_info.default_value = *attrs; 108 field_info.default_value = *attrs;
109 } 109 }
110 ++attrs; 110 ++attrs;
111 } 111 }
112 112
113 // Record this field type, default value pair. 113 // Record this field type, default value pair.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 char* attr_end = NULL; 251 char* attr_end = NULL;
252 double value = strtod(attribute, &attr_end); 252 double value = strtod(attribute, &attr_end);
253 if (attr_end != NULL && attr_end == attribute) { 253 if (attr_end != NULL && attr_end == attribute) {
254 context->RaiseError(XML_ERROR_SYNTAX); 254 context->RaiseError(XML_ERROR_SYNTAX);
255 return 0.0; 255 return 0.0;
256 } 256 }
257 return value; 257 return value;
258 } 258 }
259 259
260 } // namespace autofill 260 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_type_unittest.cc ('k') | components/autofill/core/browser/contact_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698