Index: chrome/browser/cocoa/constrained_window_mac.mm |
diff --git a/chrome/browser/cocoa/constrained_window_mac.mm b/chrome/browser/cocoa/constrained_window_mac.mm |
index ed5cba0cd897ad76e928396b545193e8899106a9..5670dabc8dad5f352efdbc9481b88686a077d4ff 100644 |
--- a/chrome/browser/cocoa/constrained_window_mac.mm |
+++ b/chrome/browser/cocoa/constrained_window_mac.mm |
@@ -46,9 +46,16 @@ ConstrainedWindowMac::ConstrainedWindowMac( |
TabContents* owner, ConstrainedWindowMacDelegate* delegate) |
: owner_(owner), |
delegate_(delegate), |
- controller_(nil) { |
+ controller_(nil), |
+ should_be_visible_(false) { |
DCHECK(owner); |
DCHECK(delegate); |
+} |
+ |
+ConstrainedWindowMac::~ConstrainedWindowMac() {} |
+ |
+void ConstrainedWindowMac::ShowConstrainedWindow() { |
+ should_be_visible_ = true; |
// The TabContents only has a native window if it is currently visible. In |
// this case, open the sheet now. Else, Realize() will be called later, when |
@@ -61,8 +68,6 @@ ConstrainedWindowMac::ConstrainedWindowMac( |
} |
} |
-ConstrainedWindowMac::~ConstrainedWindowMac() {} |
- |
void ConstrainedWindowMac::CloseConstrainedWindow() { |
// Note: controller_ can be `nil` here if the sheet was never realized. That's |
// ok. |
@@ -74,6 +79,9 @@ void ConstrainedWindowMac::CloseConstrainedWindow() { |
} |
void ConstrainedWindowMac::Realize(BrowserWindowController* controller) { |
+ if (!should_be_visible_) |
+ return; |
+ |
if (controller_ != nil) { |
DCHECK(controller_ == controller); |
return; |