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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 NativeWidget* CreateNativeWidget(NativeWidget* native_widget, | 55 NativeWidget* CreateNativeWidget(NativeWidget* native_widget, |
56 internal::NativeWidgetDelegate* delegate, | 56 internal::NativeWidgetDelegate* delegate, |
57 gfx::NativeView parent) { | 57 gfx::NativeView parent) { |
58 if (!native_widget) { | 58 if (!native_widget) { |
59 if (ViewsDelegate::views_delegate) { | 59 if (ViewsDelegate::views_delegate) { |
60 native_widget = | 60 native_widget = |
61 ViewsDelegate::views_delegate->CreateNativeWidget(delegate, parent); | 61 ViewsDelegate::views_delegate->CreateNativeWidget(delegate, parent); |
62 } | 62 } |
63 if (!native_widget) { | 63 if (!native_widget) { |
64 native_widget = | 64 native_widget = |
65 internal::NativeWidgetPrivate::CreateNativeWidget(delegate); | 65 internal::NativeWidgetPrivate::CreateNativeWidget(delegate, parent); |
66 } | 66 } |
67 } | 67 } |
68 return native_widget; | 68 return native_widget; |
69 } | 69 } |
70 | 70 |
71 } // namespace | 71 } // namespace |
72 | 72 |
73 // This class is used to keep track of the event a Widget is processing, and | 73 // This class is used to keep track of the event a Widget is processing, and |
74 // restore any previously active event afterwards. | 74 // restore any previously active event afterwards. |
75 class ScopedEvent { | 75 class ScopedEvent { |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 void Widget::SetSize(const gfx::Size& size) { | 459 void Widget::SetSize(const gfx::Size& size) { |
460 native_widget_->SetSize(size); | 460 native_widget_->SetSize(size); |
461 } | 461 } |
462 | 462 |
463 void Widget::CenterWindow(const gfx::Size& size) { | 463 void Widget::CenterWindow(const gfx::Size& size) { |
464 native_widget_->CenterWindow(size); | 464 native_widget_->CenterWindow(size); |
465 } | 465 } |
466 | 466 |
467 void Widget::SetBoundsConstrained(const gfx::Rect& bounds) { | 467 void Widget::SetBoundsConstrained(const gfx::Rect& bounds) { |
468 gfx::Rect work_area = | 468 gfx::Rect work_area = |
469 gfx::Screen::GetDisplayNearestPoint(bounds.origin()).work_area(); | 469 gfx::Screen::GetDisplayNearestPoint( |
| 470 gfx::Screen::BadTwoWorldsContext(), bounds.origin()).work_area(); |
470 if (work_area.IsEmpty()) { | 471 if (work_area.IsEmpty()) { |
471 SetBounds(bounds); | 472 SetBounds(bounds); |
472 } else { | 473 } else { |
473 // Inset the work area slightly. | 474 // Inset the work area slightly. |
474 work_area.Inset(10, 10, 10, 10); | 475 work_area.Inset(10, 10, 10, 10); |
475 SetBounds(work_area.AdjustToFit(bounds)); | 476 SetBounds(work_area.AdjustToFit(bounds)); |
476 } | 477 } |
477 } | 478 } |
478 | 479 |
479 void Widget::SetVisibilityChangedAnimationsEnabled(bool value) { | 480 void Widget::SetVisibilityChangedAnimationsEnabled(bool value) { |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 | 1348 |
1348 //////////////////////////////////////////////////////////////////////////////// | 1349 //////////////////////////////////////////////////////////////////////////////// |
1349 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1350 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1350 | 1351 |
1351 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1352 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1352 return this; | 1353 return this; |
1353 } | 1354 } |
1354 | 1355 |
1355 } // namespace internal | 1356 } // namespace internal |
1356 } // namespace views | 1357 } // namespace views |
OLD | NEW |