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

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: Better. 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 | « chrome/browser/ui/views/native_constrained_window_aura.cc ('k') | ui/aura/client/aura_constants.h » ('j') | 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..506ee60fcf04e741e27c3cee7cea88b04320d216 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -16,6 +16,7 @@
#include "content/public/browser/web_contents_view_delegate.h"
#include "content/public/browser/web_drag_dest_delegate.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/drag_drop_delegate.h"
#include "ui/aura/root_window.h"
@@ -489,6 +490,17 @@ 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]->GetProperty(
+ aura::client::kConstrainedWindowKey)) {
+ 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 | « chrome/browser/ui/views/native_constrained_window_aura.cc ('k') | ui/aura/client/aura_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698