OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/widget/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/drag_drop_client.h" | 10 #include "ui/aura/client/drag_drop_client.h" |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 NativeWidgetAura* native_widget = | 764 NativeWidgetAura* native_widget = |
765 static_cast<NativeWidgetAura*>(GetNativeWidgetForNativeView(*i)); | 765 static_cast<NativeWidgetAura*>(GetNativeWidgetForNativeView(*i)); |
766 if (native_widget) | 766 if (native_widget) |
767 children->insert(native_widget->GetWidget()); | 767 children->insert(native_widget->GetWidget()); |
768 } | 768 } |
769 } | 769 } |
770 | 770 |
771 // static | 771 // static |
772 void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, | 772 void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, |
773 gfx::NativeView new_parent) { | 773 gfx::NativeView new_parent) { |
774 // http://crbug.com/102576 | 774 DCHECK(native_view != new_parent); |
775 NOTIMPLEMENTED(); | 775 |
| 776 gfx::NativeView previous_parent = native_view->parent(); |
| 777 if (previous_parent == new_parent) |
| 778 return; |
| 779 |
| 780 Widget::Widgets widgets; |
| 781 GetAllChildWidgets(native_view, &widgets); |
| 782 |
| 783 // First notify all the widgets that they are being disassociated |
| 784 // from their previous parent. |
| 785 for (Widget::Widgets::iterator it = widgets.begin(); |
| 786 it != widgets.end(); ++it) { |
| 787 (*it)->NotifyNativeViewHierarchyChanged(false, previous_parent); |
| 788 } |
| 789 |
| 790 native_view->SetParent(new_parent); |
| 791 |
| 792 // And now, notify them that they have a brand new parent. |
| 793 for (Widget::Widgets::iterator it = widgets.begin(); |
| 794 it != widgets.end(); ++it) { |
| 795 (*it)->NotifyNativeViewHierarchyChanged(true, new_parent); |
| 796 } |
776 } | 797 } |
777 | 798 |
778 // static | 799 // static |
779 bool NativeWidgetPrivate::IsMouseButtonDown() { | 800 bool NativeWidgetPrivate::IsMouseButtonDown() { |
780 return aura::Desktop::GetInstance()->IsMouseButtonDown(); | 801 return aura::Desktop::GetInstance()->IsMouseButtonDown(); |
781 } | 802 } |
782 | 803 |
783 } // namespace internal | 804 } // namespace internal |
784 } // namespace views | 805 } // namespace views |
OLD | NEW |