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

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

Issue 1694443004: [Autofill] Add credit card first and last name heuristics predictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch2 Created 4 years, 9 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 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/form_structure.h" 5 #include "components/autofill/core/browser/form_structure.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 // content_switches.h isn't accessible from here, hence we have 202 // content_switches.h isn't accessible from here, hence we have
203 // to copy the string literal. This should be removed soon anyway. 203 // to copy the string literal. This should be removed soon anyway.
204 if (autocomplete_attribute_value == "address" && 204 if (autocomplete_attribute_value == "address" &&
205 base::CommandLine::ForCurrentProcess()->HasSwitch( 205 base::CommandLine::ForCurrentProcess()->HasSwitch(
206 "enable-experimental-web-platform-features")) { 206 "enable-experimental-web-platform-features")) {
207 return HTML_TYPE_FULL_ADDRESS; 207 return HTML_TYPE_FULL_ADDRESS;
208 } 208 }
209 209
210 if (autocomplete_attribute_value == "cc-name") 210 if (autocomplete_attribute_value == "cc-name")
211 return HTML_TYPE_CREDIT_CARD_NAME; 211 return HTML_TYPE_CREDIT_CARD_NAME_FULL;
212
213 if (autocomplete_attribute_value == "cc-given-name")
214 return HTML_TYPE_CREDIT_CARD_NAME_FIRST;
215
216 if (autocomplete_attribute_value == "cc-family-name")
217 return HTML_TYPE_CREDIT_CARD_NAME_LAST;
212 218
213 if (autocomplete_attribute_value == "cc-number") 219 if (autocomplete_attribute_value == "cc-number")
214 return HTML_TYPE_CREDIT_CARD_NUMBER; 220 return HTML_TYPE_CREDIT_CARD_NUMBER;
215 221
216 if (autocomplete_attribute_value == "cc-exp") { 222 if (autocomplete_attribute_value == "cc-exp") {
217 if (field.max_length == 5) 223 if (field.max_length == 5)
218 return HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR; 224 return HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR;
219 else if (field.max_length == 7) 225 else if (field.max_length == 7)
220 return HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR; 226 return HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR;
221 else 227 else
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 strings[i].at(prefix_len) != strings[0].at(prefix_len)) { 1296 strings[i].at(prefix_len) != strings[0].at(prefix_len)) {
1291 // Mismatch found. 1297 // Mismatch found.
1292 return base::StringPiece16(strings[i].data(), prefix_len); 1298 return base::StringPiece16(strings[i].data(), prefix_len);
1293 } 1299 }
1294 } 1300 }
1295 } 1301 }
1296 return strings[0]; 1302 return strings[0];
1297 } 1303 }
1298 1304
1299 } // namespace autofill 1305 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698