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

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: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2070352e3e15bb180e273a115570016501d65515 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -489,6 +489,15 @@ void WebContentsViewAura::OnBoundsChanged(const gfx::Rect& old_bounds,
SizeChangedCommon(new_bounds.size());
if (delegate_.get())
delegate_->SizeChanged(new_bounds.size());
+
+ // Constrained web dialog windows, need to be kept centered over our content
+ // area. Note that the dialog is the second child - so we start with index 1.
+ for (size_t i = 1; i < window_->children().size(); i++) {
sky 2012/09/14 17:23:21 Now you've got me worried. Add a property that is
Mr4D (OOO till 08-26) 2012/09/14 20:44:03 Aha! I knew it! :) Done.
+ 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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698