blob: 7e8926a9338d481af7ebc977d142aa8dff64888c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "views/widget/native_widget_test_utils.h"
#include "views/view.h"
#include "views/widget/native_widget_private.h"
#include "views/widget/widget.h"
namespace views {
namespace internal {
namespace {
NativeWidgetPrivate* CreateNativeWidgetOfType(Widget::InitParams::Type type) {
Widget* widget = new Widget;
Widget::InitParams params(type);
params.ownership = views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET;
params.child = false; // Implicitly set to true by ctor with TYPE_CONTROL.
params.bounds = gfx::Rect(10, 10, 200, 200);
widget->Init(params);
return widget->native_widget_private();
}
} // namespace
NativeWidgetPrivate* CreateNativeWidget() {
return CreateNativeWidgetOfType(Widget::InitParams::TYPE_POPUP);
}
NativeWidgetPrivate* CreateNativeSubWidget() {
return CreateNativeWidgetOfType(Widget::InitParams::TYPE_CONTROL);
}
} // namespace internal
} // namespace ui
|