| Index: chrome/browser/ui/autofill/data_model_wrapper.cc
|
| diff --git a/chrome/browser/ui/autofill/data_model_wrapper.cc b/chrome/browser/ui/autofill/data_model_wrapper.cc
|
| index b8f1c3c9bf1bb3a8b379190ca6208087ae58cb9f..07aef1f2dfea9c684cc9a3ef67179535a3c27743 100644
|
| --- a/chrome/browser/ui/autofill/data_model_wrapper.cc
|
| +++ b/chrome/browser/ui/autofill/data_model_wrapper.cc
|
| @@ -13,6 +13,7 @@
|
| #include "components/autofill/browser/autofill_type.h"
|
| #include "components/autofill/browser/credit_card.h"
|
| #include "components/autofill/browser/form_structure.h"
|
| +#include "components/autofill/browser/validation.h"
|
| #include "components/autofill/browser/wallet/full_wallet.h"
|
| #include "components/autofill/browser/wallet/wallet_address.h"
|
| #include "components/autofill/browser/wallet/wallet_items.h"
|
| @@ -104,6 +105,10 @@ void AutofillProfileWrapper::FillInputs(DetailInputs* inputs) {
|
| }
|
| }
|
|
|
| +bool AutofillProfileWrapper::IsValid() const {
|
| + return true;
|
| +}
|
| +
|
| // AutofillCreditCardWrapper
|
|
|
| AutofillCreditCardWrapper::AutofillCreditCardWrapper(const CreditCard* card)
|
| @@ -143,6 +148,13 @@ void AutofillCreditCardWrapper::FillFormField(AutofillField* field) {
|
| field->set_heuristic_type(field_type);
|
| }
|
|
|
| +bool AutofillCreditCardWrapper::IsValid() const {
|
| + return autofill::IsValidCreditCardExpirationDate(
|
| + card_->GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR),
|
| + card_->GetRawInfo(CREDIT_CARD_EXP_MONTH),
|
| + base::Time::Now());
|
| +}
|
| +
|
| // WalletAddressWrapper
|
|
|
| WalletAddressWrapper::WalletAddressWrapper(
|
| @@ -154,6 +166,10 @@ string16 WalletAddressWrapper::GetInfo(AutofillFieldType type) {
|
| return address_->GetInfo(type, g_browser_process->GetApplicationLocale());
|
| }
|
|
|
| +bool WalletAddressWrapper::IsValid() const {
|
| + return true;
|
| +}
|
| +
|
| // WalletInstrumentWrapper
|
|
|
| WalletInstrumentWrapper::WalletInstrumentWrapper(
|
| @@ -180,6 +196,12 @@ string16 WalletInstrumentWrapper::GetDisplayText() {
|
| return line1 + ASCIIToUTF16("\n") + DataModelWrapper::GetDisplayText();
|
| }
|
|
|
| +bool WalletInstrumentWrapper::IsValid() const {
|
| + // TODO(dbeam): handle other instrument statuses? http://crbug.com/233048
|
| + return instrument_->status() !=
|
| + wallet::WalletItems::MaskedInstrument::EXPIRED;
|
| +}
|
| +
|
| // FullWalletBillingWrapper
|
|
|
| FullWalletBillingWrapper::FullWalletBillingWrapper(
|
| @@ -198,6 +220,11 @@ string16 FullWalletBillingWrapper::GetInfo(AutofillFieldType type) {
|
| type, g_browser_process->GetApplicationLocale());
|
| }
|
|
|
| +bool FullWalletBillingWrapper::IsValid() const {
|
| + // TODO(dbeam): handle other required actions? http://crbug.com/163508
|
| + return !full_wallet_->HasRequiredAction(wallet::UPDATE_EXPIRATION_DATE);
|
| +}
|
| +
|
| // FullWalletShippingWrapper
|
|
|
| FullWalletShippingWrapper::FullWalletShippingWrapper(
|
| @@ -213,4 +240,8 @@ string16 FullWalletShippingWrapper::GetInfo(AutofillFieldType type) {
|
| type, g_browser_process->GetApplicationLocale());
|
| }
|
|
|
| +bool FullWalletShippingWrapper::IsValid() const {
|
| + return true;
|
| +}
|
| +
|
| } // namespace autofill
|
|
|