| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/widget/widget.h" | 5 #include "ui/views/widget/widget.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 if (bounds.IsEmpty()) { | 1449 if (bounds.IsEmpty()) { |
| 1450 View* contents_view = GetContentsView(); | 1450 View* contents_view = GetContentsView(); |
| 1451 DCHECK(contents_view); | 1451 DCHECK(contents_view); |
| 1452 // No initial bounds supplied, so size the window to its content and | 1452 // No initial bounds supplied, so size the window to its content and |
| 1453 // center over its parent if preferred size is provided. | 1453 // center over its parent if preferred size is provided. |
| 1454 gfx::Size size = contents_view->GetPreferredSize(); | 1454 gfx::Size size = contents_view->GetPreferredSize(); |
| 1455 if (!size.IsEmpty()) | 1455 if (!size.IsEmpty()) |
| 1456 native_widget_->CenterWindow(size); | 1456 native_widget_->CenterWindow(size); |
| 1457 } else { | 1457 } else { |
| 1458 // Use the supplied initial bounds. | 1458 // Use the supplied initial bounds. |
| 1459 SetBoundsConstrained(bounds); | 1459 SetBounds(bounds); |
| 1460 } | 1460 } |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 bool Widget::GetSavedWindowPlacement(gfx::Rect* bounds, | 1463 bool Widget::GetSavedWindowPlacement(gfx::Rect* bounds, |
| 1464 ui::WindowShowState* show_state) { | 1464 ui::WindowShowState* show_state) { |
| 1465 // First we obtain the window's saved show-style and store it. We need to do | 1465 // First we obtain the window's saved show-style and store it. We need to do |
| 1466 // this here, rather than in Show() because by the time Show() is called, | 1466 // this here, rather than in Show() because by the time Show() is called, |
| 1467 // the window's size will have been reset (below) and the saved maximized | 1467 // the window's size will have been reset (below) and the saved maximized |
| 1468 // state will have been lost. Sadly there's no way to tell on Windows when | 1468 // state will have been lost. Sadly there's no way to tell on Windows when |
| 1469 // a window is restored from maximized state, so we can't more accurately | 1469 // a window is restored from maximized state, so we can't more accurately |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1491 | 1491 |
| 1492 //////////////////////////////////////////////////////////////////////////////// | 1492 //////////////////////////////////////////////////////////////////////////////// |
| 1493 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1493 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1494 | 1494 |
| 1495 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1495 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1496 return this; | 1496 return this; |
| 1497 } | 1497 } |
| 1498 | 1498 |
| 1499 } // namespace internal | 1499 } // namespace internal |
| 1500 } // namespace views | 1500 } // namespace views |
| OLD | NEW |