diff options
author | rhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-17 23:43:25 +0000 |
---|---|---|
committer | rhashimoto@chromium.org <rhashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-17 23:43:25 +0000 |
commit | 8e472cd2c27d426ee28b910af3e80d82b50af9fd (patch) | |
tree | 439c1fdef72fcbb50c7f0e6a86f74aff191a000a /views/widget/native_widget_views.cc | |
parent | 67192b4b7800af69dda3168877db3d9d4f1f202d (diff) | |
download | chromium_src-8e472cd2c27d426ee28b910af3e80d82b50af9fd.zip chromium_src-8e472cd2c27d426ee28b910af3e80d82b50af9fd.tar.gz chromium_src-8e472cd2c27d426ee28b910af3e80d82b50af9fd.tar.bz2 |
Implement NativeWidgetViews::CenterWindow().
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7655023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97240 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/native_widget_views.cc')
-rw-r--r-- | views/widget/native_widget_views.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/views/widget/native_widget_views.cc b/views/widget/native_widget_views.cc index 92ec9aa..4009df8 100644 --- a/views/widget/native_widget_views.cc +++ b/views/widget/native_widget_views.cc @@ -260,8 +260,10 @@ void NativeWidgetViews::ReplaceInputMethod(InputMethod* input_method) { } void NativeWidgetViews::CenterWindow(const gfx::Size& size) { - // TODO(beng): actually center. - GetView()->SetBounds(0, 0, size.width(), size.height()); + const gfx::Size parent_size = GetView()->parent()->size(); + GetView()->SetBounds((parent_size.width() - size.width())/2, + (parent_size.height() - size.height())/2, + size.width(), size.height()); } void NativeWidgetViews::GetWindowBoundsAndMaximizedState( |