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

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

Issue 1052513002: Autofill OSX: Draw red outline around incorrect CVC input. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fix include order. 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 f8d9a8170960b44b04e70d8a7be9532666e0182b..7a2c8e837be2d7d9156a482334507408fcbc1383 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
@@ -9,6 +9,7 @@
#include "chrome/browser/ui/autofill/autofill_dialog_types.h"
#include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h"
#include "chrome/browser/ui/chrome_style.h"
+#import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.h"
#include "chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
@@ -129,7 +130,7 @@ void CardUnmaskPromptViewBridge::PerformClose() {
base::scoped_nsobject<NSTextField> titleLabel_;
base::scoped_nsobject<NSTextField> permanentErrorLabel_;
base::scoped_nsobject<NSTextField> instructionsLabel_;
- base::scoped_nsobject<NSTextField> cvcInput_;
+ base::scoped_nsobject<AutofillTextField> cvcInput_;
base::scoped_nsobject<NSPopUpButton> monthPopup_;
base::scoped_nsobject<NSPopUpButton> yearPopup_;
base::scoped_nsobject<NSButton> cancelButton_;
@@ -213,6 +214,12 @@ void CardUnmaskPromptViewBridge::PerformClose() {
SysUTF16ToNSString(text), kErrorFontStyle, NSNaturalTextAlignment,
NSLineBreakByWordWrapping);
[errorLabel_ setAttributedStringValue:attributedString];
+
+ // If there is more than one input showing, don't mark anything as
+ // invalid since we don't know the location of the problem.
+ if (!text.empty() && !bridge_->GetController()->ShouldRequestExpirationDate())
+ [cvcInput_ setValidityMessage:@"invalid"];
bondd 2015/04/01 18:13:14 AutofillTextField only checks this string for leng
groby-ooo-7-16 2015/04/02 22:32:56 I know :) Check if this is used as a hover messag
+
[self performLayoutAndDisplay:YES];
}
@@ -294,6 +301,10 @@ void CardUnmaskPromptViewBridge::PerformClose() {
// Called when text in CVC input field changes.
- (void)controlTextDidChange:(NSNotification*)notification {
+ if (bridge_->GetController()->InputCvcIsValid(
+ base::SysNSStringToUTF16([cvcInput_ stringValue])))
+ [cvcInput_ setValidityMessage:@""];
+
[self updateVerifyButtonEnabled];
}
@@ -496,7 +507,7 @@ void CardUnmaskPromptViewBridge::PerformClose() {
}
// Add CVC text input.
- cvcInput_.reset([[NSTextField alloc] initWithFrame:NSZeroRect]);
+ cvcInput_.reset([[AutofillTextField alloc] initWithFrame:NSZeroRect]);
[[cvcInput_ cell]
setPlaceholderString:l10n_util::GetNSString(
IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC)];
« 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