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

Unified Diff: chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.mm

Issue 1032193003: Autofill OSX: Show error message if expiration date is in the past. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cup_09_add_error_text_03
Patch Set: Created 5 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.mm
diff --git a/chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.mm b/chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.mm
index 799bd76661debeaa951b38ecfe5ce79074444a02..f5e9903252e159cbfc3b8933f3d85ff8789eb776 100644
--- a/chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.mm
+++ b/chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.mm
@@ -210,26 +210,16 @@ void CardUnmaskPromptViewBridge::PerformClose() {
}
- (void)updateVerifyButtonEnabled {
- autofill::CardUnmaskPromptController* controller = bridge_->GetController();
- DCHECK(controller);
bondd 2015/03/25 21:03:59 After looking deeper into dialog close+destruction
-
- BOOL enable =
- ![inputRowView_ isHidden] &&
- controller->InputCvcIsValid(
- base::SysNSStringToUTF16([cvcInput_ stringValue])) &&
- (!monthPopup_ ||
- [monthPopup_ indexOfSelectedItem] != monthPopupDefaultIndex_) &&
- (!yearPopup_ ||
- [yearPopup_ indexOfSelectedItem] != yearPopupDefaultIndex_);
+ BOOL enable = ![inputRowView_ isHidden] &&
+ bridge_->GetController()->InputCvcIsValid(
+ base::SysNSStringToUTF16([cvcInput_ stringValue])) &&
+ [self expirationDateIsValid];
[verifyButton_ setEnabled:enable];
}
- (void)onVerify:(id)sender {
- autofill::CardUnmaskPromptController* controller = bridge_->GetController();
- DCHECK(controller);
bondd 2015/03/25 21:03:59 Same here.
-
- controller->OnUnmaskResponse(
+ bridge_->GetController()->OnUnmaskResponse(
base::SysNSStringToUTF16([cvcInput_ stringValue]),
base::SysNSStringToUTF16([monthPopup_ titleOfSelectedItem]),
base::SysNSStringToUTF16([yearPopup_ titleOfSelectedItem]),
@@ -240,7 +230,25 @@ void CardUnmaskPromptViewBridge::PerformClose() {
bridge_->PerformClose();
}
+- (BOOL)expirationDateIsValid {
+ if (!bridge_->GetController()->ShouldRequestExpirationDate())
+ return true;
+
+ return bridge_->GetController()->InputExpirationIsValid(
+ base::SysNSStringToUTF16([monthPopup_ titleOfSelectedItem]),
+ base::SysNSStringToUTF16([yearPopup_ titleOfSelectedItem]));
+}
+
- (void)onExpirationDateChanged:(id)sender {
+ if ([self expirationDateIsValid]) {
+ [self setRetriableErrorMessage:base::string16()];
bondd 2015/03/25 21:03:59 Open CL https://codereview.chromium.org/1038503003
+ } else if ([monthPopup_ indexOfSelectedItem] != monthPopupDefaultIndex_ &&
groby-ooo-7-16 2015/03/25 21:44:58 Why would the default month/year not be validated?
bondd 2015/03/26 00:42:27 Yeah, I noticed this too. My guess is that it's be
groby-ooo-7-16 2015/03/26 01:24:41 Is the default item at least not selectable? (I.e.
+ [yearPopup_ indexOfSelectedItem] != yearPopupDefaultIndex_) {
+ [self setRetriableErrorMessage:
+ l10n_util::GetStringUTF16(
+ IDS_AUTOFILL_CARD_UNMASK_INVALID_EXPIRATION_DATE)];
+ }
+
[self updateVerifyButtonEnabled];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698