Index: ui/views/widget/native_widget_aura.cc |
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc |
index 7b1805e19e618da5d2093bf803acd7820315d121..cbe9c443e18da6c312b69c39c1976431e2b8b2cc 100644 |
--- a/ui/views/widget/native_widget_aura.cc |
+++ b/ui/views/widget/native_widget_aura.cc |
@@ -771,8 +771,29 @@ void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view, |
// static |
void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, |
gfx::NativeView new_parent) { |
- // http://crbug.com/102576 |
- NOTIMPLEMENTED(); |
+ DCHECK(native_view != new_parent); |
+ |
+ 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 |