Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: ui/views/widget/native_widget_aura.cc

Issue 588113002: Change Widget::GetAllOwnedWidgets to return child widgets as well (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aid_resilient_to_uninstall_and_profile_changes
Patch Set: Merged GetAllChildWidgets and GetAllOwnedWidgets Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 28893559798560c5f228f0e2d2dca31cf1cd7316..4eb58287e30b71a5a2945b954a85774fde99bcbe 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -1087,36 +1087,29 @@ NativeWidgetPrivate* NativeWidgetPrivate::GetTopLevelNativeWidget(
}
// static
-void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view,
- Widget::Widgets* children) {
+void NativeWidgetPrivate::GetAllChildAndOwnedWidgets(
+ gfx::NativeView native_view,
+ Widget::Widgets* widgets) {
{
- // Code expects widget for |native_view| to be added to |children|.
+ // Code expects widget for |native_view| to be added to |widgets|.
NativeWidgetPrivate* native_widget = static_cast<NativeWidgetPrivate*>(
GetNativeWidgetForNativeView(native_view));
if (native_widget && native_widget->GetWidget())
- children->insert(native_widget->GetWidget());
+ widgets->insert(native_widget->GetWidget());
}
- const aura::Window::Windows& child_windows = native_view->children();
- for (aura::Window::Windows::const_iterator i = child_windows.begin();
- i != child_windows.end(); ++i) {
- GetAllChildWidgets((*i), children);
- }
-}
-
-// static
-void NativeWidgetPrivate::GetAllOwnedWidgets(gfx::NativeView native_view,
- Widget::Widgets* owned) {
- const aura::Window::Windows& transient_children =
- wm::GetTransientChildren(native_view);
- for (aura::Window::Windows::const_iterator i = transient_children.begin();
- i != transient_children.end(); ++i) {
+ // Add all owned widgets.
+ for (aura::Window* transient_child : wm::GetTransientChildren(native_view)) {
NativeWidgetPrivate* native_widget = static_cast<NativeWidgetPrivate*>(
- GetNativeWidgetForNativeView(*i));
+ GetNativeWidgetForNativeView(transient_child));
if (native_widget && native_widget->GetWidget())
- owned->insert(native_widget->GetWidget());
- GetAllOwnedWidgets((*i), owned);
+ widgets->insert(native_widget->GetWidget());
+ GetAllChildAndOwnedWidgets(transient_child, widgets);
}
+
+ // Add all child windows.
+ for (aura::Window* child : native_view->children())
+ GetAllChildAndOwnedWidgets(child, widgets);
}
// static
@@ -1129,7 +1122,7 @@ void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view,
return;
Widget::Widgets widgets;
- GetAllChildWidgets(native_view, &widgets);
+ GetAllChildAndOwnedWidgets(native_view, &widgets);
// First notify all the widgets that they are being disassociated
// from their previous parent.

Powered by Google App Engine
This is Rietveld 408576698