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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 | 502 |
503 void Widget::SetSize(const gfx::Size& size) { | 503 void Widget::SetSize(const gfx::Size& size) { |
504 native_widget_->SetSize(size); | 504 native_widget_->SetSize(size); |
505 } | 505 } |
506 | 506 |
507 void Widget::CenterWindow(const gfx::Size& size) { | 507 void Widget::CenterWindow(const gfx::Size& size) { |
508 native_widget_->CenterWindow(size); | 508 native_widget_->CenterWindow(size); |
509 } | 509 } |
510 | 510 |
511 void Widget::SetBoundsConstrained(const gfx::Rect& bounds) { | 511 void Widget::SetBoundsConstrained(const gfx::Rect& bounds) { |
512 gfx::Rect work_area = | 512 gfx::Rect work_area = gfx::Screen::GetScreen() |
513 gfx::Screen::GetScreenFor(GetNativeView())->GetDisplayNearestPoint( | 513 ->GetDisplayNearestPoint(bounds.origin()) |
514 bounds.origin()).work_area(); | 514 .work_area(); |
515 if (work_area.IsEmpty()) { | 515 if (work_area.IsEmpty()) { |
516 SetBounds(bounds); | 516 SetBounds(bounds); |
517 } else { | 517 } else { |
518 // Inset the work area slightly. | 518 // Inset the work area slightly. |
519 work_area.Inset(10, 10, 10, 10); | 519 work_area.Inset(10, 10, 10, 10); |
520 work_area.AdjustToFit(bounds); | 520 work_area.AdjustToFit(bounds); |
521 SetBounds(work_area); | 521 SetBounds(work_area); |
522 } | 522 } |
523 } | 523 } |
524 | 524 |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 | 1490 |
1491 //////////////////////////////////////////////////////////////////////////////// | 1491 //////////////////////////////////////////////////////////////////////////////// |
1492 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1492 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1493 | 1493 |
1494 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1494 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1495 return this; | 1495 return this; |
1496 } | 1496 } |
1497 | 1497 |
1498 } // namespace internal | 1498 } // namespace internal |
1499 } // namespace views | 1499 } // namespace views |
OLD | NEW |