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

Unified Diff: components/autofill/core/browser/autofill_manager.cc

Issue 2249773002: Scan card holder name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass CreditCard, don't alter the constructor. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/autofill_manager.cc
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 711ffb4e3229329dfdadfa3246d194d2776e6878..1eea943cd6bb46745419f9a7c33a188b2fd423c7 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -263,15 +263,20 @@ bool AutofillManager::ShouldShowScanCreditCard(const FormData& form,
return false;
AutofillField* autofill_field = GetAutofillField(form, field);
- if (!autofill_field ||
- autofill_field->Type().GetStorableType() != CREDIT_CARD_NUMBER) {
+ if (!autofill_field)
+ return false;
+
+ bool is_card_number_field =
+ autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER &&
+ base::ContainsOnlyChars(CreditCard::StripSeparators(field.value),
+ base::ASCIIToUTF16("0123456789"));
+ if (!is_card_number_field &&
+ autofill_field->Type().GetStorableType() != CREDIT_CARD_NAME_FULL) {
return false;
}
static const int kShowScanCreditCardMaxValueLength = 6;
- return field.value.size() <= kShowScanCreditCardMaxValueLength &&
- base::ContainsOnlyChars(CreditCard::StripSeparators(field.value),
- base::ASCIIToUTF16("0123456789"));
+ return field.value.size() <= kShowScanCreditCardMaxValueLength;
}
bool AutofillManager::ShouldShowCreditCardSigninPromo(
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698