diff options
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.mm | 4 | ||||
-rw-r--r-- | chrome/browser/cocoa/status_bubble_mac.h | 4 | ||||
-rw-r--r-- | chrome/browser/cocoa/status_bubble_mac.mm | 15 |
3 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index ca668f2..df4cc6f 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -1673,6 +1673,10 @@ willAnimateFromState:(bookmarks::VisualState)oldState [self layoutSubviews]; } + // Move the status bubble over, if we have one. + if (statusBubble_) + statusBubble_->SwitchParentWindow(destWindow); + // The window needs to be onscreen before we can set its first responder. [destWindow makeKeyAndOrderFront:self]; [focusTracker restoreFocusInWindow:destWindow]; diff --git a/chrome/browser/cocoa/status_bubble_mac.h b/chrome/browser/cocoa/status_bubble_mac.h index e43b81f..472df3f 100644 --- a/chrome/browser/cocoa/status_bubble_mac.h +++ b/chrome/browser/cocoa/status_bubble_mac.h @@ -44,6 +44,10 @@ class StatusBubbleMac : public StatusBubble { // exist. void UpdateSizeAndPosition(); + // Mac-specific method: Change the parent window of the status bubble. Safe to + // call even when the status bubble does not exist. + void SwitchParentWindow(NSWindow* parent); + // Delegate method called when a fade-in or fade-out transition has // completed. This is public so that it may be visible to the CAAnimation // delegate, which is an Objective-C object. diff --git a/chrome/browser/cocoa/status_bubble_mac.mm b/chrome/browser/cocoa/status_bubble_mac.mm index c9cecfb..6135f60 100644 --- a/chrome/browser/cocoa/status_bubble_mac.mm +++ b/chrome/browser/cocoa/status_bubble_mac.mm @@ -533,6 +533,21 @@ void StatusBubbleMac::UpdateSizeAndPosition() { [window_ setFrame:CalculateWindowFrame() display:YES]; } +void StatusBubbleMac::SwitchParentWindow(NSWindow* parent) { + DCHECK(parent); + + // If not attached, just update our member variable and return. + if (!is_attached()) { + parent_ = parent; + return; + } + + Detach(); + parent_ = parent; + Attach(); + UpdateSizeAndPosition(); +} + NSRect StatusBubbleMac::CalculateWindowFrame() { DCHECK(parent_); |