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

Side by Side 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: Minor fix Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « ui/views/accessibility/native_view_accessibility_win.cc ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 const aura::Window::Windows& child_windows = native_view->children(); 1100 const aura::Window::Windows& child_windows = native_view->children();
1101 for (aura::Window::Windows::const_iterator i = child_windows.begin(); 1101 for (aura::Window::Windows::const_iterator i = child_windows.begin();
1102 i != child_windows.end(); ++i) { 1102 i != child_windows.end(); ++i) {
1103 GetAllChildWidgets((*i), children); 1103 GetAllChildWidgets((*i), children);
1104 } 1104 }
1105 } 1105 }
1106 1106
1107 // static 1107 // static
1108 void NativeWidgetPrivate::GetAllOwnedWidgets(gfx::NativeView native_view, 1108 void NativeWidgetPrivate::GetAllOwnedWidgets(gfx::NativeView native_view,
1109 Widget::Widgets* owned) { 1109 Widget::Widgets* owned) {
1110 const aura::Window::Windows& transient_children = 1110 // Add all owned widgets.
1111 wm::GetTransientChildren(native_view); 1111 for (aura::Window* transient_child : wm::GetTransientChildren(native_view)) {
1112 for (aura::Window::Windows::const_iterator i = transient_children.begin();
1113 i != transient_children.end(); ++i) {
1114 NativeWidgetPrivate* native_widget = static_cast<NativeWidgetPrivate*>( 1112 NativeWidgetPrivate* native_widget = static_cast<NativeWidgetPrivate*>(
1115 GetNativeWidgetForNativeView(*i)); 1113 GetNativeWidgetForNativeView(transient_child));
1116 if (native_widget && native_widget->GetWidget()) 1114 if (native_widget && native_widget->GetWidget())
1117 owned->insert(native_widget->GetWidget()); 1115 owned->insert(native_widget->GetWidget());
1118 GetAllOwnedWidgets((*i), owned); 1116 GetAllOwnedWidgets(transient_child, owned);
1119 } 1117 }
1118
1119 // Add all child windows.
1120 for (aura::Window* child : native_view->children())
1121 GetAllChildWidgets(child, owned);
1120 } 1122 }
1121 1123
1122 // static 1124 // static
1123 void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, 1125 void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view,
1124 gfx::NativeView new_parent) { 1126 gfx::NativeView new_parent) {
1125 DCHECK(native_view != new_parent); 1127 DCHECK(native_view != new_parent);
1126 1128
1127 gfx::NativeView previous_parent = native_view->parent(); 1129 gfx::NativeView previous_parent = native_view->parent();
1128 if (previous_parent == new_parent) 1130 if (previous_parent == new_parent)
1129 return; 1131 return;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 1179 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
1178 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 1180 base::win::ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
1179 return gfx::FontList(gfx::Font(caption_font)); 1181 return gfx::FontList(gfx::Font(caption_font));
1180 #else 1182 #else
1181 return gfx::FontList(); 1183 return gfx::FontList();
1182 #endif 1184 #endif
1183 } 1185 }
1184 1186
1185 } // namespace internal 1187 } // namespace internal
1186 } // namespace views 1188 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/accessibility/native_view_accessibility_win.cc ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698