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

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: Evan's review 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
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 59bf9eaa35bd0d0af5ae678e6afe085c11bf0612..b746e9c59ce1dd6eec6c04aa24bc8f0c7c49bdd2 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -244,6 +244,13 @@ void UserDidOptIntoLocationServices() {
content::GeolocationProvider::GetInstance()->UserDidOptIntoLocationServices();
}
+bool IsCardHolderNameValidForWallet(const string16& name) {
+ base::string16 whitespace_collapsed_name = CollapseWhitespace(name, true);
+ std::vector<base::string16> split_name;
+ SplitString(whitespace_collapsed_name, ' ', &split_name);
+ return split_name.size() >= 2;
+}
+
} // namespace
AutofillDialogController::~AutofillDialogController() {}
@@ -1113,6 +1120,16 @@ ValidityData AutofillDialogControllerImpl::InputsAreValid(
}
}
+ // Wallet requires a first and last name.
+ if (field_values.count(CREDIT_CARD_NAME)) {
Evan Stade 2013/05/23 23:28:40 can you put this in InputValidityMessage()? Inputs
ahutter 2013/05/24 18:36:02 Done.
+ if (IsPayingWithWallet() &&
+ !IsCardHolderNameValidForWallet(field_values[CREDIT_CARD_NAME])) {
+ invalid_messages[CREDIT_CARD_NAME] =
+ l10n_util::GetStringUTF16(
+ IDS_AUTOFILL_DIALOG_VALIDATION_WALLET_REQUIRES_TWO_NAMES);
+ }
+ }
+
// 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 | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698