| 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/hit_test.h" | 10 #include "ui/base/hit_test.h" |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 } | 442 } |
| 443 | 443 |
| 444 void Widget::SetBounds(const gfx::Rect& bounds) { | 444 void Widget::SetBounds(const gfx::Rect& bounds) { |
| 445 native_widget_->SetBounds(bounds); | 445 native_widget_->SetBounds(bounds); |
| 446 } | 446 } |
| 447 | 447 |
| 448 void Widget::SetSize(const gfx::Size& size) { | 448 void Widget::SetSize(const gfx::Size& size) { |
| 449 native_widget_->SetSize(size); | 449 native_widget_->SetSize(size); |
| 450 } | 450 } |
| 451 | 451 |
| 452 void Widget::CenterWindow(const gfx::Size& size) { |
| 453 native_widget_->CenterWindow(size); |
| 454 } |
| 455 |
| 452 void Widget::SetBoundsConstrained(const gfx::Rect& bounds) { | 456 void Widget::SetBoundsConstrained(const gfx::Rect& bounds) { |
| 453 gfx::Rect work_area = | 457 gfx::Rect work_area = |
| 454 gfx::Screen::GetMonitorWorkAreaNearestPoint(bounds.origin()); | 458 gfx::Screen::GetMonitorWorkAreaNearestPoint(bounds.origin()); |
| 455 if (work_area.IsEmpty()) { | 459 if (work_area.IsEmpty()) { |
| 456 SetBounds(bounds); | 460 SetBounds(bounds); |
| 457 } else { | 461 } else { |
| 458 // Inset the work area slightly. | 462 // Inset the work area slightly. |
| 459 work_area.Inset(10, 10, 10, 10); | 463 work_area.Inset(10, 10, 10, 10); |
| 460 SetBounds(work_area.AdjustToFit(bounds)); | 464 SetBounds(work_area.AdjustToFit(bounds)); |
| 461 } | 465 } |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 | 1283 |
| 1280 //////////////////////////////////////////////////////////////////////////////// | 1284 //////////////////////////////////////////////////////////////////////////////// |
| 1281 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1285 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1282 | 1286 |
| 1283 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1287 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1284 return this; | 1288 return this; |
| 1285 } | 1289 } |
| 1286 | 1290 |
| 1287 } // namespace internal | 1291 } // namespace internal |
| 1288 } // namespace views | 1292 } // namespace views |
| OLD | NEW |