Index: ui/views/widget/widget.cc |
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc |
index aaa93204548a5852016807a0b8235ed343020f68..04c9011b9d92d0689770a0fc8631518cc489c587 100644 |
--- a/ui/views/widget/widget.cc |
+++ b/ui/views/widget/widget.cc |
@@ -1449,9 +1449,16 @@ void Widget::SetInitialBounds(const gfx::Rect& bounds) { |
} |
} else { |
if (bounds.IsEmpty()) { |
- // No initial bounds supplied, so size the window to its content and |
- // center over its parent. |
- native_widget_->CenterWindow(non_client_view_->GetPreferredSize()); |
+ if (bounds.origin().IsOrigin()) { |
+ // No initial bounds supplied, so size the window to its content and |
+ // center over its parent. |
+ native_widget_->CenterWindow(non_client_view_->GetPreferredSize()); |
+ } else { |
+ // Use the preferred size and the supplied origin. |
+ gfx::Rect preferred_bounds(bounds); |
+ preferred_bounds.set_size(non_client_view_->GetPreferredSize()); |
+ SetBoundsConstrained(preferred_bounds); |
+ } |
} else { |
// Use the supplied initial bounds. |
SetBoundsConstrained(bounds); |