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

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: Chunks anti-de-un-mismatched. 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..5e7a3c2ee55b4a4b34d8f0a1152090b21a639b0a 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
@@ -100,6 +100,8 @@ typedef BOOL (^FieldFilterBlock)(NSView<AutofillInputField>*);
}
- (BOOL)validate {
+ errorBubbleAnchorView_ = nil;
Ilya Sherman 2014/01/08 00:25:37 Hmm, why does this reset the anchor view? Might b
groby-ooo-7-16 2014/01/08 20:15:31 You asked for it. It's long :)
+
bool allValid = true;
for (AutofillSectionContainer* details in details_.get()) {
if (![[details view] isHidden])
@@ -156,11 +158,20 @@ typedef BOOL (^FieldFilterBlock)(NSView<AutofillInputField>*);
name:NSWindowWillCloseNotification
object:[errorBubbleController_ window]];
errorBubbleController_ = nil;
+ errorBubbleAnchorView_ = nil;
}
- (void)showErrorBubbleForField:(NSControl<AutofillInputField>*)field {
- if (errorBubbleController_)
+ // If there is already a bubble controller handling this field, reuse.
+ if (errorBubbleController_ && errorBubbleAnchorView_ == field) {
+ [errorBubbleController_ setMessage:[field validityMessage]];
+
+ return;
+ }
+
+ if (errorBubbleController_) {
[errorBubbleController_ close];
+ }
Ilya Sherman 2014/01/08 00:25:37 nit: Why curlies?
groby-ooo-7-16 2014/01/08 20:15:31 Habit. Done.
DCHECK(!errorBubbleController_);
NSWindow* parentWindow = [field window];
DCHECK(parentWindow);
@@ -203,6 +214,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