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

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

Issue 14425010: Handle expired Autofill credit cards in autofill dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 8 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/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..418f4cb01f5721c4ad5dd27c0e41dc04809683b2 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"
@@ -125,6 +126,13 @@ gfx::Image AutofillCreditCardWrapper::GetIcon() {
}
string16 AutofillCreditCardWrapper::GetDisplayText() {
+ if (!autofill::IsValidCreditCardExpirationDate(
+ card_->GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR),
+ card_->GetRawInfo(CREDIT_CARD_EXP_MONTH),
+ base::Time::Now())) {
+ return string16();
+ }
+
return card_->TypeAndLastFourDigits();
}
@@ -174,6 +182,10 @@ gfx::Image WalletInstrumentWrapper::GetIcon() {
}
string16 WalletInstrumentWrapper::GetDisplayText() {
+ // TODO(dbeam): handle other instrument statuses? http://crbug.com/233048
+ if (instrument_->status() == wallet::WalletItems::MaskedInstrument::EXPIRED)
+ return string16();
+
// TODO(estade): descriptive_name() is user-provided. Should we use it or
// just type + last 4 digits?
string16 line1 = instrument_->descriptive_name();
@@ -198,6 +210,14 @@ string16 FullWalletBillingWrapper::GetInfo(AutofillFieldType type) {
type, g_browser_process->GetApplicationLocale());
}
+string16 FullWalletBillingWrapper::GetDisplayText() {
+ // TODO(dbeam): handle other required actions? http://crbug.com/163508
+ if (full_wallet_->HasRequiredAction(wallet::UPDATE_EXPIRATION_DATE))
+ return string16();
+
+ return DataModelWrapper::GetDisplayText();
+}
+
// FullWalletShippingWrapper
FullWalletShippingWrapper::FullWalletShippingWrapper(
« no previous file with comments | « chrome/browser/ui/autofill/data_model_wrapper.h ('k') | chrome/browser/ui/autofill/data_model_wrapper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698