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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 15401005: Force at least first and last name for CREDIT_CARD_NAME when using Wallet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index 8189b300408c1a13e0e5d219a2810dbd96758ed6..3e792f925092e3e35cca2e882a29401dc1f36fe5 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -244,6 +244,16 @@ void UserDidOptIntoLocationServices() {
content::GeolocationProvider::GetInstance()->UserDidOptIntoLocationServices();
}
+bool IsCardHolderNameValidForWallet(const string16& name) {
+ base::string16 trimmed_name;
+ TrimWhitespace(name, TRIM_ALL, &trimmed_name);
+ base::string16 whitespace_collapsed_name = CollapseWhitespace(trimmed_name,
Evan Stade 2013/05/23 16:40:37 collapsewhitespace trims (so I don't think you nee
ahutter 2013/05/23 23:19:11 Done.
+ true);
+ std::vector<base::string16> split_name;
+ SplitString(whitespace_collapsed_name, ' ', &split_name);
+ return split_name.size() >= 2;
+}
+
} // namespace
AutofillDialogController::~AutofillDialogController() {}
@@ -1116,6 +1126,15 @@ ValidityData AutofillDialogControllerImpl::InputsAreValid(
}
}
+ // Wallet requires a first and last name.
+ if (field_values.count(CREDIT_CARD_NAME)) {
+ if (IsPayingWithWallet() &&
+ !IsCardHolderNameValidForWallet(field_values[CREDIT_CARD_NAME])) {
+ invalid_messages[CREDIT_CARD_NAME] =
+ ASCIIToUTF16("Google Wallet requires a first and last name");
Evan Stade 2013/05/23 16:40:37 i10n
ahutter 2013/05/23 23:19:11 Done.
+ }
+ }
+
// If there is a credit card number and a CVC, validate them together.
if (field_values.count(CREDIT_CARD_NUMBER) &&
field_values.count(CREDIT_CARD_VERIFICATION_CODE) &&
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698