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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "ui/base/events/event.h" | 10 #include "ui/base/events/event.h" |
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 } | 1251 } |
1252 | 1252 |
1253 void Widget::SetInitialBounds(const gfx::Rect& bounds) { | 1253 void Widget::SetInitialBounds(const gfx::Rect& bounds) { |
1254 if (!non_client_view_) | 1254 if (!non_client_view_) |
1255 return; | 1255 return; |
1256 | 1256 |
1257 gfx::Rect saved_bounds; | 1257 gfx::Rect saved_bounds; |
1258 if (GetSavedWindowPlacement(&saved_bounds, &saved_show_state_)) { | 1258 if (GetSavedWindowPlacement(&saved_bounds, &saved_show_state_)) { |
1259 if (saved_show_state_ == ui::SHOW_STATE_MAXIMIZED) { | 1259 if (saved_show_state_ == ui::SHOW_STATE_MAXIMIZED) { |
1260 // If we're going to maximize, wait until Show is invoked to set the | 1260 // If we're going to maximize, wait until Show is invoked to set the |
1261 // bounds. That way we avoid a noticable resize. | 1261 // bounds. That way we avoid a noticeable resize. |
1262 initial_restored_bounds_ = saved_bounds; | 1262 initial_restored_bounds_ = saved_bounds; |
1263 } else { | 1263 } else { |
1264 SetBounds(saved_bounds); | 1264 SetBounds(saved_bounds); |
1265 } | 1265 } |
1266 } else { | 1266 } else { |
1267 if (bounds.IsEmpty()) { | 1267 if (bounds.IsEmpty()) { |
1268 // No initial bounds supplied, so size the window to its content and | 1268 // No initial bounds supplied, so size the window to its content and |
1269 // center over its parent. | 1269 // center over its parent. |
1270 native_widget_->CenterWindow(non_client_view_->GetPreferredSize()); | 1270 native_widget_->CenterWindow(non_client_view_->GetPreferredSize()); |
1271 } else { | 1271 } else { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 | 1327 |
1328 //////////////////////////////////////////////////////////////////////////////// | 1328 //////////////////////////////////////////////////////////////////////////////// |
1329 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1329 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1330 | 1330 |
1331 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1331 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1332 return this; | 1332 return this; |
1333 } | 1333 } |
1334 | 1334 |
1335 } // namespace internal | 1335 } // namespace internal |
1336 } // namespace views | 1336 } // namespace views |
OLD | NEW |