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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java

Issue 1926553002: Prompt for expiration date for local cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify the test cases Created 4 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
« no previous file with comments | « no previous file | components/autofill/core/browser/credit_card.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java
index 9aca6c31e1f4c034e7c967e2edc32015de655b20..4230f6b02c6b7566e00e8227b720790342795830 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/CardUnmaskPrompt.java
@@ -47,6 +47,7 @@ public class CardUnmaskPrompt
private final AlertDialog mDialog;
private boolean mShouldRequestExpirationDate;
private final int mThisYear;
+ private final int mThisMonth;
private final View mMainView;
private final TextView mInstructions;
@@ -138,6 +139,7 @@ public class CardUnmaskPrompt
mShouldRequestExpirationDate = shouldRequestExpirationDate;
mThisYear = Calendar.getInstance().get(Calendar.YEAR);
+ mThisMonth = Calendar.getInstance().get(Calendar.MONTH) + 1;
}
public void show() {
@@ -321,8 +323,9 @@ public class CardUnmaskPrompt
private boolean areInputsValid() {
if (mShouldRequestExpirationDate) {
+ int month = -1;
try {
- int month = Integer.parseInt(mMonthInput.getText().toString());
+ month = Integer.parseInt(mMonthInput.getText().toString());
if (month < 1 || month > 12) return false;
} catch (NumberFormatException e) {
return false;
@@ -330,6 +333,8 @@ public class CardUnmaskPrompt
int year = getFourDigitYear();
if (year < mThisYear || year > mThisYear + 10) return false;
+
+ if (year == mThisYear && month < mThisMonth) return false;
}
return mDelegate.checkUserInputValidity(mCardUnmaskInput.getText().toString());
}
« no previous file with comments | « no previous file | components/autofill/core/browser/credit_card.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698