| 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/widget_gtk.h" | 8 #include "views/widget/native_widget.h" |
| 9 #include "views/widget/widget.h" |
| 9 | 10 |
| 10 namespace views { | 11 namespace views { |
| 11 namespace internal { | 12 namespace internal { |
| 12 | 13 |
| 13 NativeWidget* CreateNativeWidget() { | 14 NativeWidget* CreateNativeWidget() { |
| 14 return CreateNativeWidgetWithContents(new View); | 15 return CreateNativeWidgetWithContents(new View); |
| 15 } | 16 } |
| 16 | 17 |
| 17 NativeWidget* CreateNativeWidgetWithContents(View* contents_view) { | 18 NativeWidget* CreateNativeWidgetWithContents(View* contents_view) { |
| 18 WidgetGtk* widget = new WidgetGtk(WidgetGtk::TYPE_WINDOW); | 19 Widget* widget = Widget::CreateWidget(); |
| 19 widget->set_delete_on_destroy(false); | 20 Widget::CreateParams params(Widget::CreateParams::TYPE_WINDOW); |
| 20 widget->Init(NULL, gfx::Rect(10, 10, 200, 200)); | 21 params.delete_on_destroy = false; |
| 21 return widget; | 22 params.bounds = gfx::Rect(10, 10, 200, 200); |
| 23 widget->Init(params); |
| 24 return widget->native_widget(); |
| 22 } | 25 } |
| 23 | 26 |
| 24 NativeWidget* CreateNativeWidgetWithParent(NativeWidget* parent) { | 27 NativeWidget* CreateNativeWidgetWithParent(NativeWidget* parent) { |
| 25 WidgetGtk* widget = new WidgetGtk(WidgetGtk::TYPE_CHILD); | 28 Widget* widget = Widget::CreateWidget(); |
| 26 widget->set_delete_on_destroy(false); | 29 Widget::CreateParams params(Widget::CreateParams::TYPE_CONTROL); |
| 27 widget->Init(parent ? parent->GetWidget()->GetNativeView() : NULL, | 30 params.delete_on_destroy = false; |
| 28 gfx::Rect(10, 10, 200, 200)); | 31 params.parent = parent ? parent->GetWidget()->GetNativeView() : NULL; |
| 29 return widget; | 32 params.bounds = gfx::Rect(10, 10, 200, 200); |
| 33 widget->Init(params); |
| 34 return widget->native_widget(); |
| 30 } | 35 } |
| 31 | 36 |
| 32 } // namespace internal | 37 } // namespace internal |
| 33 } // namespace ui | 38 } // namespace ui |
| OLD | NEW |