From eeb92a5123019390ec81acdcabf675168eb520bd Mon Sep 17 00:00:00 2001 From: "oshima@chromium.org" Date: Wed, 12 Oct 2011 09:19:40 +0000 Subject: Enable NativeConstrainedWindowAura Implement NativeWidgetAura::CenterWindow. The content of the html dialog is current blank due to a bug somewhere else. I'll address it in separate CL. BUG=none TEST=none Review URL: http://codereview.chromium.org/8224020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105047 0039d316-1c4b-4281-b951-d872f2087c98 --- views/widget/native_widget_aura.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'views/widget') diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc index 76e34c9..bfd603f 100644 --- a/views/widget/native_widget_aura.cc +++ b/views/widget/native_widget_aura.cc @@ -32,8 +32,10 @@ namespace views { namespace { -int GetAuraWindowTypeForWidgetType(Widget::InitParams::Type type) { - switch (type) { +int GetAuraWindowTypeFromInitParams(const Widget::InitParams& params) { + if (params.child) + return aura::kWindowType_Control; + switch (params.type) { case Widget::InitParams::TYPE_WINDOW: case Widget::InitParams::TYPE_WINDOW_FRAMELESS: case Widget::InitParams::TYPE_POPUP: @@ -92,7 +94,7 @@ gfx::Font NativeWidgetAura::GetWindowTitleFont() { void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { ownership_ = params.ownership; window_->set_user_data(this); - window_->SetType(GetAuraWindowTypeForWidgetType(params.type)); + window_->SetType(GetAuraWindowTypeFromInitParams(params)); window_->Init(); // TODO(beng): respect |params| authoritah wrt transparency. window_->layer()->SetFillsBoundsOpaquely(false); @@ -221,7 +223,11 @@ InputMethod* NativeWidgetAura::CreateInputMethod() { } void NativeWidgetAura::CenterWindow(const gfx::Size& size) { - NOTIMPLEMENTED(); + const gfx::Rect parent_bounds = window_->parent()->bounds(); + window_->SetBounds(gfx::Rect((parent_bounds.width() - size.width())/2, + (parent_bounds.height() - size.height())/2, + size.width(), + size.height())); } void NativeWidgetAura::GetWindowPlacement( -- cgit v1.1