OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1136 Widget::Widgets widgets; | 1136 Widget::Widgets widgets; |
1137 GetAllChildWidgets(native_view, &widgets); | 1137 GetAllChildWidgets(native_view, &widgets); |
1138 | 1138 |
1139 // First notify all the widgets that they are being disassociated | 1139 // First notify all the widgets that they are being disassociated |
1140 // from their previous parent. | 1140 // from their previous parent. |
1141 for (Widget::Widgets::iterator it = widgets.begin(); | 1141 for (Widget::Widgets::iterator it = widgets.begin(); |
1142 it != widgets.end(); ++it) { | 1142 it != widgets.end(); ++it) { |
1143 (*it)->NotifyNativeViewHierarchyWillChange(); | 1143 (*it)->NotifyNativeViewHierarchyWillChange(); |
1144 } | 1144 } |
1145 | 1145 |
1146 if (new_parent) { | 1146 if (new_parent) |
1147 new_parent->AddChild(native_view); | 1147 new_parent->AddChild(native_view); |
1148 } else { | 1148 else if (previous_parent) |
1149 // The following looks weird, but it's the equivalent of what aura has | 1149 previous_parent->RemoveChild(native_view); |
1150 // always done. (The previous behaviour of aura::Window::SetParent() used | |
1151 // NULL as a special value that meant ask the WindowTreeClient where things | |
1152 // should go.) | |
1153 // | |
1154 // This probably isn't strictly correct, but its an invariant that a Window | |
1155 // in use will be attached to a RootWindow, so we can't just call | |
1156 // RemoveChild here. The only possible thing that could assign a RootWindow | |
1157 // in this case is the stacking client of the current RootWindow. This | |
1158 // matches our previous behaviour; the global stacking client would almost | |
1159 // always reattach the window to the same RootWindow. | |
1160 aura::Window* root_window = native_view->GetRootWindow(); | |
sky
2016/05/31 17:00:57
Why is this code no longer necessary?
sadrul
2016/05/31 17:25:14
As the comment suggests, this isn't really correct
| |
1161 aura::client::ParentWindowWithContext( | |
1162 native_view, root_window, root_window->GetBoundsInScreen()); | |
1163 } | |
1164 | 1150 |
1165 // And now, notify them that they have a brand new parent. | 1151 // And now, notify them that they have a brand new parent. |
1166 for (Widget::Widgets::iterator it = widgets.begin(); | 1152 for (Widget::Widgets::iterator it = widgets.begin(); |
1167 it != widgets.end(); ++it) { | 1153 it != widgets.end(); ++it) { |
1168 (*it)->NotifyNativeViewHierarchyChanged(); | 1154 (*it)->NotifyNativeViewHierarchyChanged(); |
1169 } | 1155 } |
1170 } | 1156 } |
1171 | 1157 |
1172 // static | 1158 // static |
1173 bool NativeWidgetPrivate::IsMouseButtonDown() { | 1159 bool NativeWidgetPrivate::IsMouseButtonDown() { |
(...skipping 18 matching lines...) Expand all Loading... | |
1192 gfx::NativeView native_view) { | 1178 gfx::NativeView native_view) { |
1193 aura::client::CaptureClient* capture_client = | 1179 aura::client::CaptureClient* capture_client = |
1194 aura::client::GetCaptureClient(native_view->GetRootWindow()); | 1180 aura::client::GetCaptureClient(native_view->GetRootWindow()); |
1195 if (!capture_client) | 1181 if (!capture_client) |
1196 return nullptr; | 1182 return nullptr; |
1197 return capture_client->GetGlobalCaptureWindow(); | 1183 return capture_client->GetGlobalCaptureWindow(); |
1198 } | 1184 } |
1199 | 1185 |
1200 } // namespace internal | 1186 } // namespace internal |
1201 } // namespace views | 1187 } // namespace views |
OLD | NEW |