Chromium Code Reviews| 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) && |