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

Unified Diff: chrome/browser/cocoa/bookmark_bubble_controller.mm

Issue 391057: Fix multi-window bookmark bubble problem.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
Index: chrome/browser/cocoa/bookmark_bubble_controller.mm
===================================================================
--- chrome/browser/cocoa/bookmark_bubble_controller.mm (revision 32026)
+++ chrome/browser/cocoa/bookmark_bubble_controller.mm (working copy)
@@ -58,8 +58,15 @@
[self autorelease];
}
-- (void)windowDidLoad {
- NSWindow* window = [self window];
+
+// We want this to be a child of a browser window. addChildWindow:
+// (called from this function) will bring the window on-screen;
+// unfortunately, [NSWindowController showWindow:] will also bring it
+// on-screen (but will cause unexpected changes to the window's
+// position). We cannot have an addChildWindow: and a subsequent
+// showWindow:. Thus, we have our own version.
+- (void)showWindow:(id)sender {
+ NSWindow* window = [self window]; // completes nib load
NSPoint origin = [parentWindow_ convertBaseToScreen:topLeftForBubble_];
origin.y -= NSHeight([window frame]);
[window setFrameOrigin:origin];
@@ -73,10 +80,13 @@
}
[self fillInFolderList];
+
+ [[self window] makeKeyAndOrderFront:self];
}
- (void)close {
[parentWindow_ removeChildWindow:[self window]];
+ [delegate_ bubbleWindowWillClose:[self window]];
[super close];
}
@@ -134,6 +144,12 @@
- (void)windowDidResignKey:(NSNotification*)notification {
DCHECK_EQ([notification object], [self window]);
+ // We must tell our delegate our window is gone RIGHT NOW. The
+ // performSelector: call below triggers a close but it might get
+ // processed after a request to show a new bubble (e.g. in another
+ // window).
+ [delegate_ bubbleWindowWillClose:[self window]];
+
// Can't call close from within a window delegate method. Call close for the
// next time through the event loop.
[self performSelector:@selector(ok:) withObject:self afterDelay:0];
« no previous file with comments | « chrome/browser/cocoa/bookmark_bubble_controller.h ('k') | chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698