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

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

Issue 622773002: [Autofill] Autofill fails to show suggestions for credit card split across fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated nits. Created 6 years, 1 month 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_manager_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/personal_data_manager.cc
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index cbb1e8061762341da3644d40bc26b4c8a5263589..9e2a4ecef411decb3c0295df8eb974e2f57f4e5d 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -673,15 +673,16 @@ void PersonalDataManager::GetCreditCardSuggestions(
base::string16 creditcard_field_value =
credit_card->GetInfo(type, app_locale_);
if (!creditcard_field_value.empty() &&
- StartsWith(creditcard_field_value, field_contents, false)) {
- if (type.GetStorableType() == CREDIT_CARD_NUMBER)
- creditcard_field_value = credit_card->ObfuscatedNumber();
-
+ (StartsWith(creditcard_field_value, field_contents, false) ||
+ (type.GetStorableType() == CREDIT_CARD_NUMBER &&
+ base::string16::npos !=
+ creditcard_field_value.find(field_contents)))) {
// If the value is the card number, the label is the expiration date.
// Otherwise the label is the card number, or if that is empty the
// cardholder name. The label should never repeat the value.
base::string16 label;
if (type.GetStorableType() == CREDIT_CARD_NUMBER) {
+ creditcard_field_value = credit_card->ObfuscatedNumber();
label = credit_card->GetInfo(
AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_);
} else if (credit_card->number().empty()) {
« no previous file with comments | « components/autofill/core/browser/autofill_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698