| 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 void Widget::SetInitialBounds(const gfx::Rect& bounds) { | 1347 void Widget::SetInitialBounds(const gfx::Rect& bounds) { |
| 1348 if (!non_client_view_) | 1348 if (!non_client_view_) |
| 1349 return; | 1349 return; |
| 1350 | 1350 |
| 1351 gfx::Rect saved_bounds; | 1351 gfx::Rect saved_bounds; |
| 1352 if (GetSavedWindowPlacement(&saved_bounds, &saved_show_state_)) { | 1352 if (GetSavedWindowPlacement(&saved_bounds, &saved_show_state_)) { |
| 1353 if (saved_show_state_ == ui::SHOW_STATE_MAXIMIZED) { | 1353 if (saved_show_state_ == ui::SHOW_STATE_MAXIMIZED) { |
| 1354 // If we're going to maximize, wait until Show is invoked to set the | 1354 // If we're going to maximize, wait until Show is invoked to set the |
| 1355 // bounds. That way we avoid a noticeable resize. | 1355 // bounds. That way we avoid a noticeable resize. |
| 1356 initial_restored_bounds_ = saved_bounds; | 1356 initial_restored_bounds_ = saved_bounds; |
| 1357 } else { | 1357 } else if (!saved_bounds.IsEmpty()) { |
| 1358 // If the saved bounds are valid, use them. |
| 1358 SetBounds(saved_bounds); | 1359 SetBounds(saved_bounds); |
| 1359 } | 1360 } |
| 1360 } else { | 1361 } else { |
| 1361 if (bounds.IsEmpty()) { | 1362 if (bounds.IsEmpty()) { |
| 1362 // No initial bounds supplied, so size the window to its content and | 1363 // No initial bounds supplied, so size the window to its content and |
| 1363 // center over its parent. | 1364 // center over its parent. |
| 1364 native_widget_->CenterWindow(non_client_view_->GetPreferredSize()); | 1365 native_widget_->CenterWindow(non_client_view_->GetPreferredSize()); |
| 1365 } else { | 1366 } else { |
| 1366 // Use the supplied initial bounds. | 1367 // Use the supplied initial bounds. |
| 1367 SetBoundsConstrained(bounds); | 1368 SetBoundsConstrained(bounds); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 | 1422 |
| 1422 //////////////////////////////////////////////////////////////////////////////// | 1423 //////////////////////////////////////////////////////////////////////////////// |
| 1423 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1424 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1424 | 1425 |
| 1425 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1426 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1426 return this; | 1427 return this; |
| 1427 } | 1428 } |
| 1428 | 1429 |
| 1429 } // namespace internal | 1430 } // namespace internal |
| 1430 } // namespace views | 1431 } // namespace views |
| OLD | NEW |