Commit 6f1e8731 authored by pkotwicz@chromium.org's avatar pkotwicz@chromium.org

Implements Aura:: NativeWidgetPrivate::ReparentNativeView

BUG=102576
TEST=None


Review URL: http://codereview.chromium.org/8741022

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113130 0039d316-1c4b-4281-b951-d872f2087c98
parent 28aa2ede
...@@ -69,8 +69,9 @@ gfx::NativeView SadTabObserver::AcquireSadTab(base::TerminationStatus status) { ...@@ -69,8 +69,9 @@ gfx::NativeView SadTabObserver::AcquireSadTab(base::TerminationStatus status) {
SadTabView::KILLED : SadTabView::CRASHED; SadTabView::KILLED : SadTabView::CRASHED;
views::Widget::InitParams sad_tab_params( views::Widget::InitParams sad_tab_params(
views::Widget::InitParams::TYPE_CONTROL); views::Widget::InitParams::TYPE_CONTROL);
// It is not possible to create a widget that has no parent, and later // It is not possible to create a native_widget_win that has no parent in
// re-parent it. TODO(avi): This is a cheat. Can this be made cleaner? // and later re-parent it.
// TODO(avi): This is a cheat. Can this be made cleaner?
sad_tab_params.parent_widget = sad_tab_params.parent_widget =
static_cast<TabContentsViewViews*>(tab_contents()->view()); static_cast<TabContentsViewViews*>(tab_contents()->view());
sad_tab_params.ownership = sad_tab_params.ownership =
......
...@@ -764,8 +764,29 @@ void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view, ...@@ -764,8 +764,29 @@ void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view,
// static // static
void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view,
gfx::NativeView new_parent) { gfx::NativeView new_parent) {
// http://crbug.com/102576 DCHECK(native_view != new_parent);
NOTIMPLEMENTED();
gfx::NativeView previous_parent = native_view->parent();
if (previous_parent == new_parent)
return;
Widget::Widgets widgets;
GetAllChildWidgets(native_view, &widgets);
// First notify all the widgets that they are being disassociated
// from their previous parent.
for (Widget::Widgets::iterator it = widgets.begin();
it != widgets.end(); ++it) {
(*it)->NotifyNativeViewHierarchyChanged(false, previous_parent);
}
native_view->SetParent(new_parent);
// And now, notify them that they have a brand new parent.
for (Widget::Widgets::iterator it = widgets.begin();
it != widgets.end(); ++it) {
(*it)->NotifyNativeViewHierarchyChanged(true, new_parent);
}
} }
// static // static
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment