| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/native_widget_test_utils.h" | 5 #include "views/widget/native_widget_test_utils.h" |
| 6 | 6 |
| 7 #include "views/view.h" | 7 #include "views/view.h" |
| 8 #include "views/widget/native_widget_private.h" | 8 #include "views/widget/native_widget_private.h" |
| 9 #include "views/widget/widget.h" | 9 #include "views/widget/widget.h" |
| 10 | 10 |
| 11 namespace views { | 11 namespace views { |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 NativeWidgetPrivate* CreateNativeWidget() { | 14 namespace { |
| 15 return CreateNativeWidgetWithContents(new View); | |
| 16 } | |
| 17 | 15 |
| 18 NativeWidgetPrivate* CreateNativeWidgetWithContents(View* contents_view) { | 16 NativeWidgetPrivate* CreateNativeWidgetOfType(Widget::InitParams::Type type) { |
| 19 Widget* widget = new Widget; | 17 Widget* widget = new Widget; |
| 20 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); | 18 Widget::InitParams params(type); |
| 21 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 19 params.ownership = views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET; |
| 20 params.child = false; // Implicitly set to true by ctor with TYPE_CONTROL. |
| 22 params.bounds = gfx::Rect(10, 10, 200, 200); | 21 params.bounds = gfx::Rect(10, 10, 200, 200); |
| 23 widget->Init(params); | 22 widget->Init(params); |
| 24 return widget->native_widget_private(); | 23 return widget->native_widget_private(); |
| 25 } | 24 } |
| 26 | 25 |
| 27 NativeWidgetPrivate* CreateNativeWidgetWithParent(NativeWidgetPrivate* parent) { | 26 } // namespace |
| 28 Widget* widget = new Widget; | 27 |
| 29 Widget::InitParams params(Widget::InitParams::TYPE_CONTROL); | 28 NativeWidgetPrivate* CreateNativeWidget() { |
| 30 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 29 return CreateNativeWidgetOfType(Widget::InitParams::TYPE_POPUP); |
| 31 params.child = false; // Implicitly set to true by ctor with TYPE_CONTROL. | 30 } |
| 32 params.parent = parent ? parent->GetWidget()->GetNativeView() : NULL; | 31 |
| 33 params.bounds = gfx::Rect(10, 10, 200, 200); | 32 NativeWidgetPrivate* CreateNativeSubWidget() { |
| 34 widget->Init(params); | 33 return CreateNativeWidgetOfType(Widget::InitParams::TYPE_CONTROL); |
| 35 return widget->native_widget_private(); | |
| 36 } | 34 } |
| 37 | 35 |
| 38 } // namespace internal | 36 } // namespace internal |
| 39 } // namespace ui | 37 } // namespace ui |
| OLD | NEW |