summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-06 21:09:46 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-06 21:09:46 +0000
commit5a9de31f01f29f0a2c754598a7f4c7eea7c3771e (patch)
treeabfc3cdb052e57dc7d3bdfd9cbbb15ac55351dc0 /ui
parent8c1e91b079517e00fb2d8e58594524e798aa08b6 (diff)
downloadchromium_src-5a9de31f01f29f0a2c754598a7f4c7eea7c3771e.zip
chromium_src-5a9de31f01f29f0a2c754598a7f4c7eea7c3771e.tar.gz
chromium_src-5a9de31f01f29f0a2c754598a7f4c7eea7c3771e.tar.bz2
views cleanup: Merge parent and parent_widget.
According to Ben, parent_widget is a leftover from when we had NativeViewGtk. It isn't needed now and everything should be handleable by the normal parent. BUG=161882 Review URL: https://chromiumcodereview.appspot.com/11299317 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/views/bubble/bubble_delegate.cc6
-rw-r--r--ui/views/controls/menu/menu_host.cc2
-rw-r--r--ui/views/controls/native/native_view_host_unittest.cc2
-rw-r--r--ui/views/examples/widget_example.cc4
-rw-r--r--ui/views/focus/focus_manager_unittest.cc2
-rw-r--r--ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc4
-rw-r--r--ui/views/widget/desktop_aura/desktop_root_window_host_win.cc2
-rw-r--r--ui/views/widget/native_widget_aura.cc2
-rw-r--r--ui/views/widget/native_widget_win.cc2
-rw-r--r--ui/views/widget/widget.cc8
-rw-r--r--ui/views/widget/widget.h4
-rw-r--r--ui/views/widget/widget_unittest.cc10
12 files changed, 19 insertions, 29 deletions
diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc
index 51a1824..28dbb09 100644
--- a/ui/views/bubble/bubble_delegate.cc
+++ b/ui/views/bubble/bubble_delegate.cc
@@ -30,8 +30,8 @@ Widget* CreateBubbleWidget(BubbleDelegateView* bubble) {
bubble_params.accept_events = bubble->accept_events();
if (bubble->parent_window())
bubble_params.parent = bubble->parent_window();
- else
- bubble_params.parent_widget = bubble->anchor_widget();
+ else if (bubble->anchor_widget())
+ bubble_params.parent = bubble->anchor_widget()->GetNativeView();
bubble_params.can_activate = bubble->CanActivate();
#if defined(OS_WIN) && !defined(USE_AURA)
bubble_params.type = Widget::InitParams::TYPE_WINDOW_FRAMELESS;
@@ -88,7 +88,7 @@ Widget* CreateBorderWidget(BubbleDelegateView* bubble) {
Widget::InitParams border_params(Widget::InitParams::TYPE_BUBBLE);
border_params.delegate = new BubbleBorderDelegate(bubble, border_widget);
border_params.transparent = true;
- border_params.parent_widget = bubble->GetWidget();
+ border_params.parent = bubble->GetWidget()->GetNativeView();
border_params.can_activate = false;
border_widget->Init(border_params);
border_widget->set_focus_on_creation(false);
diff --git a/ui/views/controls/menu/menu_host.cc b/ui/views/controls/menu/menu_host.cc
index dccd64e..9e07a69 100644
--- a/ui/views/controls/menu/menu_host.cc
+++ b/ui/views/controls/menu/menu_host.cc
@@ -34,7 +34,7 @@ void MenuHost::InitMenuHost(Widget* parent,
bool do_capture) {
Widget::InitParams params(Widget::InitParams::TYPE_MENU);
params.has_dropshadow = true;
- params.parent_widget = parent;
+ params.parent = parent->GetNativeView();
params.bounds = bounds;
Init(params);
diff --git a/ui/views/controls/native/native_view_host_unittest.cc b/ui/views/controls/native/native_view_host_unittest.cc
index 9420d74..ba31db1d 100644
--- a/ui/views/controls/native/native_view_host_unittest.cc
+++ b/ui/views/controls/native/native_view_host_unittest.cc
@@ -90,7 +90,7 @@ TEST_F(NativeViewHostTest, NativeViewHierarchyChanged) {
scoped_ptr<Widget> child(new Widget);
Widget::InitParams child_params(Widget::InitParams::TYPE_CONTROL);
child_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
- child_params.parent_widget = toplevel.get();
+ child_params.parent = toplevel->GetNativeView();
child->Init(child_params);
child->SetContentsView(test_view);
diff --git a/ui/views/examples/widget_example.cc b/ui/views/examples/widget_example.cc
index ed45ebe..f3ab572 100644
--- a/ui/views/examples/widget_example.cc
+++ b/ui/views/examples/widget_example.cc
@@ -116,7 +116,7 @@ void WidgetExample::CreateChild(View* parent, bool transparent) {
// Initialize the child widget with the computed bounds.
Widget::InitParams params(Widget::InitParams::TYPE_CONTROL);
params.transparent = transparent;
- params.parent_widget = parent_widget;
+ params.parent = parent_widget->GetNativeView();
widget->Init(params);
InitWidget(widget, transparent);
}
@@ -136,7 +136,7 @@ void WidgetExample::CreatePopup(View* parent, bool transparent) {
// Initialize the popup widget with the computed bounds.
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
params.transparent = transparent;
- params.parent_widget = parent->GetWidget();
+ params.parent = parent->GetWidget()->GetNativeView();
params.bounds = gfx::Rect(point.x(), point.y(), 200, 300);
widget->Init(params);
InitWidget(widget, transparent);
diff --git a/ui/views/focus/focus_manager_unittest.cc b/ui/views/focus/focus_manager_unittest.cc
index a9f345d..b4d1753 100644
--- a/ui/views/focus/focus_manager_unittest.cc
+++ b/ui/views/focus/focus_manager_unittest.cc
@@ -139,7 +139,7 @@ TEST_F(FocusManagerTest, WidgetFocusChangeListener) {
Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.bounds = gfx::Rect(10, 10, 100, 100);
- params.parent_widget = GetWidget();
+ params.parent = GetWidget()->GetNativeView();
scoped_ptr<Widget> widget1(new Widget);
widget1->Init(params);
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc
index 815d2e2..eab034ca 100644
--- a/ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc
+++ b/ui/views/widget/desktop_aura/desktop_root_window_host_linux.cc
@@ -201,8 +201,8 @@ aura::RootWindow* DesktopRootWindowHostLinux::InitRootWindow(
// If we're given a parent, we need to mark ourselves as transient to another
// window. Otherwise activation gets screwy.
- gfx::NativeView parent = params.GetParent();
- if (!params.child && params.GetParent())
+ gfx::NativeView parent = params.parent;
+ if (!params.child && params.parent)
parent->AddTransientChild(content_window_);
native_widget_delegate_->OnNativeWidgetCreated();
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
index 829b1a1..3fdaef7 100644
--- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
+++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
@@ -90,7 +90,7 @@ aura::RootWindow* DesktopRootWindowHostWin::Init(
native_widget_delegate_);
HWND parent_hwnd = NULL;
- aura::Window* parent_window = params.GetParent();
+ aura::Window* parent_window = params.parent;
if (parent_window)
parent_hwnd = parent_window->GetRootWindow()->GetAcceleratedWidget();
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 8efbcea..31548af 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -107,7 +107,7 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
delegate_->OnNativeWidgetCreated();
gfx::Rect window_bounds = params.bounds;
- gfx::NativeView parent = params.GetParent();
+ gfx::NativeView parent = params.parent;
if (!params.child) {
// Set up the transient child before the window is added. This way the
// LayoutManager knows the window has a transient parent.
diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc
index d3174df..d5dbf06 100644
--- a/ui/views/widget/native_widget_win.cc
+++ b/ui/views/widget/native_widget_win.cc
@@ -144,7 +144,7 @@ void NativeWidgetWin::ClearAccessibilityViewEvent(View* view) {
void NativeWidgetWin::InitNativeWidget(const Widget::InitParams& params) {
SetInitParams(params);
- message_handler_->Init(params.GetParent(), params.bounds);
+ message_handler_->Init(params.parent, params.bounds);
}
NonClientFrameView* NativeWidgetWin::CreateNonClientFrameView() {
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 457e1fe..b2b45cd 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -155,7 +155,6 @@ Widget::InitParams::InitParams()
show_state(ui::SHOW_STATE_DEFAULT),
double_buffer(false),
parent(NULL),
- parent_widget(NULL),
native_widget(NULL),
desktop_root_window_host(NULL),
top_level(false),
@@ -181,7 +180,6 @@ Widget::InitParams::InitParams(Type type)
show_state(ui::SHOW_STATE_DEFAULT),
double_buffer(false),
parent(NULL),
- parent_widget(NULL),
native_widget(NULL),
desktop_root_window_host(NULL),
top_level(false),
@@ -189,10 +187,6 @@ Widget::InitParams::InitParams(Type type)
context(NULL) {
}
-gfx::NativeView Widget::InitParams::GetParent() const {
- return parent_widget ? parent_widget->GetNativeView() : parent;
-}
-
////////////////////////////////////////////////////////////////////////////////
// Widget, public:
@@ -336,7 +330,7 @@ void Widget::Init(const InitParams& params) {
params.delegate : new DefaultWidgetDelegate(this, params);
ownership_ = params.ownership;
native_widget_ = CreateNativeWidget(
- params.native_widget, this, params.type, params.GetParent())->
+ params.native_widget, this, params.type, params.parent)->
AsNativeWidgetPrivate();
GetRootView();
default_theme_provider_.reset(new DefaultThemeProvider);
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h
index 136ae6f..b8511ff 100644
--- a/ui/views/widget/widget.h
+++ b/ui/views/widget/widget.h
@@ -141,9 +141,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
InitParams();
explicit InitParams(Type type);
- // If |parent_widget| is non-null, its native view is returned, otherwise
- // |parent| is returned.
- gfx::NativeView GetParent() const;
// Will return the first of the following that isn't NULL: the native view,
// |parent|, |context|.
@@ -177,7 +174,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// Should the widget be double buffered? Default is false.
bool double_buffer;
gfx::NativeView parent;
- Widget* parent_widget;
// Specifies the initial bounds of the Widget. Default is empty, which means
// the NativeWidget may specify a default size. If the parent is specified,
// |bounds| is in the parent's coordinate system. If the parent is not
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc
index 065508f..1210e76 100644
--- a/ui/views/widget/widget_unittest.cc
+++ b/ui/views/widget/widget_unittest.cc
@@ -194,7 +194,7 @@ class WidgetTest : public ViewsTestBase {
Widget* CreateChildNativeWidgetWithParent(Widget* parent) {
Widget* child = new Widget;
Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_CONTROL);
- params.parent_widget = parent;
+ params.parent = parent->GetNativeView();
child->Init(params);
child->SetContentsView(new View);
return child;
@@ -581,8 +581,8 @@ TEST_F(WidgetOwnershipTest,
Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP);
params.native_widget =
new OwnershipTestNativeWidgetPlatform(widget.get(), &state);
+ params.parent = toplevel->GetNativeView();
params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
- params.parent_widget = toplevel;
widget->Init(params);
// Now close the toplevel, which deletes the view hierarchy.
@@ -630,7 +630,7 @@ TEST_F(WidgetOwnershipTest, Ownership_ViewsNativeWidgetOwnsWidget) {
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
params.native_widget =
new OwnershipTestNativeWidgetPlatform(widget, &state);
- params.parent_widget = toplevel;
+ params.parent = toplevel->GetNativeView();
widget->Init(params);
// Now destroy the native widget. This is achieved by closing the toplevel.
@@ -679,7 +679,7 @@ TEST_F(WidgetOwnershipTest,
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
params.native_widget =
new OwnershipTestNativeWidgetPlatform(widget, &state);
- params.parent_widget = toplevel;
+ params.parent = toplevel->GetNativeView();
widget->Init(params);
// Destroy the widget (achieved by closing the toplevel).
@@ -705,7 +705,7 @@ TEST_F(WidgetOwnershipTest,
Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
params.native_widget =
new OwnershipTestNativeWidgetPlatform(widget, &state);
- params.parent_widget = toplevel;
+ params.parent = toplevel->GetNativeView();
widget->Init(params);
// Destroy the widget.