| Index: chrome/browser/tab_contents/tab_contents.cc
|
| ===================================================================
|
| --- chrome/browser/tab_contents/tab_contents.cc (revision 36364)
|
| +++ chrome/browser/tab_contents/tab_contents.cc (working copy)
|
| @@ -330,8 +330,10 @@
|
| int size = static_cast<int>(child_windows_.size());
|
| for (int i = size - 1; i >= 0; --i) {
|
| ConstrainedWindow* window = child_windows_[i];
|
| - if (window)
|
| + if (window) {
|
| window->CloseConstrainedWindow();
|
| + BlockTabContent(false);
|
| + }
|
| }
|
|
|
| if (blocked_popups_)
|
| @@ -766,9 +768,21 @@
|
| ConstrainedWindow* window =
|
| ConstrainedWindow::CreateConstrainedDialog(this, delegate);
|
| child_windows_.push_back(window);
|
| +
|
| + if (child_windows_.size() == 1) {
|
| + window->ShowConstrainedWindow();
|
| + BlockTabContent(true);
|
| + }
|
| +
|
| return window;
|
| }
|
|
|
| +void TabContents::BlockTabContent(bool blocked) {
|
| + render_view_host()->set_ignore_input_events(blocked);
|
| + if (delegate_)
|
| + delegate_->SetTabContentBlocked(this, blocked);
|
| +}
|
| +
|
| void TabContents::AddNewContents(TabContents* new_contents,
|
| WindowOpenDisposition disposition,
|
| const gfx::Rect& initial_pos,
|
| @@ -1002,8 +1016,15 @@
|
| 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();
|
| + BlockTabContent(true);
|
| + } else {
|
| + BlockTabContent(false);
|
| + }
|
| }
|
|
|
| void TabContents::WillCloseBlockedPopupContainer(
|
| @@ -1403,8 +1424,11 @@
|
| int size = static_cast<int>(child_windows_.size());
|
| for (int i = size - 1; i >= 0; --i) {
|
| ConstrainedWindow* window = child_windows_[i];
|
| - if (window)
|
| + if (window) {
|
| + DCHECK(delegate_);
|
| window->CloseConstrainedWindow();
|
| + BlockTabContent(false);
|
| + }
|
| }
|
|
|
| // Close the popup container.
|
| @@ -2398,6 +2422,13 @@
|
| return RenderViewHostDelegateHelper::GetWebkitPrefs(prefs, is_dom_ui);
|
| }
|
|
|
| +void TabContents::OnIgnoredUIEvent() {
|
| + if (constrained_window_count()) {
|
| + ConstrainedWindow* window = *constrained_window_begin();
|
| + window->FocusConstrainedWindow();
|
| + }
|
| +}
|
| +
|
| void TabContents::OnJSOutOfMemory() {
|
| AddInfoBar(new SimpleAlertInfoBarDelegate(
|
| this, l10n_util::GetString(IDS_JS_OUT_OF_MEMORY_PROMPT), NULL));
|
|
|