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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 | 525 |
526 void Widget::SetSize(const gfx::Size& size) { | 526 void Widget::SetSize(const gfx::Size& size) { |
527 native_widget_->SetSize(size); | 527 native_widget_->SetSize(size); |
528 } | 528 } |
529 | 529 |
530 void Widget::CenterWindow(const gfx::Size& size) { | 530 void Widget::CenterWindow(const gfx::Size& size) { |
531 native_widget_->CenterWindow(size); | 531 native_widget_->CenterWindow(size); |
532 } | 532 } |
533 | 533 |
534 void Widget::SetBoundsConstrained(const gfx::Rect& bounds) { | 534 void Widget::SetBoundsConstrained(const gfx::Rect& bounds) { |
535 gfx::Rect work_area = | 535 gfx::Rect work_area = gfx::Screen::GetScreen() |
536 gfx::Screen::GetScreenFor(GetNativeView())->GetDisplayNearestPoint( | 536 ->GetDisplayNearestPoint(bounds.origin()) |
537 bounds.origin()).work_area(); | 537 .work_area(); |
538 if (work_area.IsEmpty()) { | 538 if (work_area.IsEmpty()) { |
539 SetBounds(bounds); | 539 SetBounds(bounds); |
540 } else { | 540 } else { |
541 // Inset the work area slightly. | 541 // Inset the work area slightly. |
542 work_area.Inset(10, 10, 10, 10); | 542 work_area.Inset(10, 10, 10, 10); |
543 work_area.AdjustToFit(bounds); | 543 work_area.AdjustToFit(bounds); |
544 SetBounds(work_area); | 544 SetBounds(work_area); |
545 } | 545 } |
546 } | 546 } |
547 | 547 |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 | 1513 |
1514 //////////////////////////////////////////////////////////////////////////////// | 1514 //////////////////////////////////////////////////////////////////////////////// |
1515 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1515 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1516 | 1516 |
1517 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1517 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1518 return this; | 1518 return this; |
1519 } | 1519 } |
1520 | 1520 |
1521 } // namespace internal | 1521 } // namespace internal |
1522 } // namespace views | 1522 } // namespace views |
OLD | NEW |