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

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: Rebase 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 // content_switches.h isn't accessible from here, hence we have 203 // content_switches.h isn't accessible from here, hence we have
204 // to copy the string literal. This should be removed soon anyway. 204 // to copy the string literal. This should be removed soon anyway.
205 if (autocomplete_attribute_value == "address" && 205 if (autocomplete_attribute_value == "address" &&
206 base::CommandLine::ForCurrentProcess()->HasSwitch( 206 base::CommandLine::ForCurrentProcess()->HasSwitch(
207 "enable-experimental-web-platform-features")) { 207 "enable-experimental-web-platform-features")) {
208 return HTML_TYPE_FULL_ADDRESS; 208 return HTML_TYPE_FULL_ADDRESS;
209 } 209 }
210 210
211 if (autocomplete_attribute_value == "cc-name") 211 if (autocomplete_attribute_value == "cc-name")
212 return HTML_TYPE_CREDIT_CARD_NAME; 212 return HTML_TYPE_CREDIT_CARD_NAME_FULL;
213
214 if (autocomplete_attribute_value == "cc-given-name")
215 return HTML_TYPE_CREDIT_CARD_NAME_FIRST;
216
217 if (autocomplete_attribute_value == "cc-family-name")
218 return HTML_TYPE_CREDIT_CARD_NAME_LAST;
213 219
214 if (autocomplete_attribute_value == "cc-number") 220 if (autocomplete_attribute_value == "cc-number")
215 return HTML_TYPE_CREDIT_CARD_NUMBER; 221 return HTML_TYPE_CREDIT_CARD_NUMBER;
216 222
217 if (autocomplete_attribute_value == "cc-exp") { 223 if (autocomplete_attribute_value == "cc-exp") {
218 if (field.max_length == 5) 224 if (field.max_length == 5)
219 return HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR; 225 return HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR;
220 else if (field.max_length == 7) 226 else if (field.max_length == 7)
221 return HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR; 227 return HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR;
222 else 228 else
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 filtered_strings[0].at(prefix_len)) { 1327 filtered_strings[0].at(prefix_len)) {
1322 // Mismatch found. 1328 // Mismatch found.
1323 return filtered_strings[i].substr(0, prefix_len); 1329 return filtered_strings[i].substr(0, prefix_len);
1324 } 1330 }
1325 } 1331 }
1326 } 1332 }
1327 return filtered_strings[0]; 1333 return filtered_strings[0];
1328 } 1334 }
1329 1335
1330 } // namespace autofill 1336 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/field_types.h ('k') | components/autofill/core/browser/form_structure_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698