summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-06 06:27:47 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-06 06:27:47 +0000
commit6f1e8731318f5ee11592e4323e919e4756a78984 (patch)
treed46dac89b144602c43b376bf4cdb562bae707341
parent28aa2ede3862c629b43fcd568466b31d7a9b7d28 (diff)
downloadchromium_src-6f1e8731318f5ee11592e4323e919e4756a78984.zip
chromium_src-6f1e8731318f5ee11592e4323e919e4756a78984.tar.gz
chromium_src-6f1e8731318f5ee11592e4323e919e4756a78984.tar.bz2
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
-rw-r--r--chrome/browser/ui/sad_tab_observer.cc5
-rw-r--r--ui/views/widget/native_widget_aura.cc25
2 files changed, 26 insertions, 4 deletions
diff --git a/chrome/browser/ui/sad_tab_observer.cc b/chrome/browser/ui/sad_tab_observer.cc
index 51a788a..4269459 100644
--- a/chrome/browser/ui/sad_tab_observer.cc
+++ b/chrome/browser/ui/sad_tab_observer.cc
@@ -69,8 +69,9 @@ gfx::NativeView SadTabObserver::AcquireSadTab(base::TerminationStatus status) {
SadTabView::KILLED : SadTabView::CRASHED;
views::Widget::InitParams sad_tab_params(
views::Widget::InitParams::TYPE_CONTROL);
- // It is not possible to create a widget that has no parent, and later
- // re-parent it. TODO(avi): This is a cheat. Can this be made cleaner?
+ // It is not possible to create a native_widget_win that has no parent in
+ // and later re-parent it.
+ // TODO(avi): This is a cheat. Can this be made cleaner?
sad_tab_params.parent_widget =
static_cast<TabContentsViewViews*>(tab_contents()->view());
sad_tab_params.ownership =
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 71500e3f..2bdba97 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -764,8 +764,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