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

Unified Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 10905290: Keep a web dialog window centered over the content area (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add constrained window flag Created 8 years, 3 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
Index: content/browser/web_contents/web_contents_view_aura.cc
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index 7d19edba5beb58f06ce2011af32432d8f5532227..91d296c6c068bbf4e37e81a348f67d71ca5df815 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -489,6 +489,16 @@ void WebContentsViewAura::OnBoundsChanged(const gfx::Rect& old_bounds,
SizeChangedCommon(new_bounds.size());
if (delegate_.get())
delegate_->SizeChanged(new_bounds.size());
+
+ // Constrained web dialogs, need to be kept centered over our content area.
+ for (size_t i = 0; i < window_->children().size(); i++) {
+ if (window_->children()[i]->is_constrained_window()) {
+ gfx::Rect bounds = window_->children()[i]->bounds();
+ bounds.Offset((new_bounds.width() - old_bounds.width()) / 2,
+ (new_bounds.height() - old_bounds.height()) / 2);
+ window_->children()[i]->SetBounds(bounds);
+ }
+ }
}
void WebContentsViewAura::OnFocus(aura::Window* old_focused_window) {

Powered by Google App Engine
This is Rietveld 408576698