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

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 541056: Tab-modal dialog improvements:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months 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
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/browser/tab_contents/tab_contents_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/browser/tab_contents/tab_contents_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698