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

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

Issue 123703002: [rAC] Do not re-create bubble window unnecessarily (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 6 years, 11 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 | « chrome/browser/ui/cocoa/autofill/autofill_details_container.h ('k') | 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/autofill_details_container.mm
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
index 633bdf2342ccf1ae36a60e68948b74d4e1d8fb0b..7961f814a8a0249a330fab577abae671fbb20f92 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
@@ -100,6 +100,14 @@ typedef BOOL (^FieldFilterBlock)(NSView<AutofillInputField>*);
}
- (BOOL)validate {
+ // Account for a subtle timing issue. -validate is called from the dialog's
+ // -accept. -accept then hides the dialog. If the data does not validate the
+ // dialog is then reshown, focusing on the first invalid field. This happens
+ // without running the message loop, so windowWillClose has not fired when
+ // the dialog and error bubble is reshown, leading to a missign error bubble.
Ilya Sherman 2014/01/08 21:48:33 nit: "missign" -> "missing"
+ // Resetting the anchor view here forces the bubble to show.
+ errorBubbleAnchorView_ = nil;
+
bool allValid = true;
for (AutofillSectionContainer* details in details_.get()) {
if (![[details view] isHidden])
@@ -156,9 +164,17 @@ typedef BOOL (^FieldFilterBlock)(NSView<AutofillInputField>*);
name:NSWindowWillCloseNotification
object:[errorBubbleController_ window]];
errorBubbleController_ = nil;
+ errorBubbleAnchorView_ = nil;
}
- (void)showErrorBubbleForField:(NSControl<AutofillInputField>*)field {
+ // If there is already a bubble controller handling this field, reuse.
+ if (errorBubbleController_ && errorBubbleAnchorView_ == field) {
+ [errorBubbleController_ setMessage:[field validityMessage]];
+
+ return;
+ }
+
if (errorBubbleController_)
[errorBubbleController_ close];
DCHECK(!errorBubbleController_);
@@ -203,6 +219,7 @@ typedef BOOL (^FieldFilterBlock)(NSView<AutofillInputField>*);
[errorBubbleController_ setAnchorPoint:
[parentWindow convertBaseToScreen:anchorPoint]];
+ errorBubbleAnchorView_ = field;
[errorBubbleController_ showWindow:self];
}
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_details_container.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698