Index: chrome/browser/tab_contents/tab_contents.cc |
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc |
index 0d2ba960bdf1286b2d74be3f88f1df38e7468d37..16c2637ef9e129b535f593b0352cbaa65d19a116 100644 |
--- a/chrome/browser/tab_contents/tab_contents.cc |
+++ b/chrome/browser/tab_contents/tab_contents.cc |
@@ -824,6 +824,10 @@ ConstrainedWindow* TabContents::CreateConstrainedDialog( |
ConstrainedWindow* window = |
ConstrainedWindow::CreateConstrainedDialog(this, delegate); |
child_windows_.push_back(window); |
+ |
+ if (child_windows_.size() == 1) |
+ window->ShowConstrainedWindow(); |
+ |
return window; |
} |
@@ -1054,8 +1058,13 @@ void TabContents::OnStartDownload(DownloadItem* download) { |
void TabContents::WillClose(ConstrainedWindow* window) { |
ConstrainedWindowList::iterator it = |
find(child_windows_.begin(), child_windows_.end(), window); |
+ |
+ bool removed_topmost_window = it == child_windows_.begin(); |
if (it != child_windows_.end()) |
child_windows_.erase(it); |
+ |
+ if (removed_topmost_window && child_windows_.size() > 0) |
+ child_windows_[0]->ShowConstrainedWindow(); |
} |
void TabContents::WillCloseBlockedPopupContainer( |