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

Unified Diff: ui/aura/window.cc

Issue 8916020: Second attempt at moving the StackingClient to a property on the RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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
« no previous file with comments | « ui/aura/test/test_stacking_client.cc ('k') | ui/aura_shell/root_window_event_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window.cc
===================================================================
--- ui/aura/window.cc (revision 114527)
+++ ui/aura/window.cc (working copy)
@@ -24,6 +24,18 @@
namespace aura {
+namespace {
+
+Window* GetParentForWindow(Window* window, Window* suggested_parent) {
+ if (suggested_parent)
+ return suggested_parent;
+ if (client::GetStackingClient())
+ return client::GetStackingClient()->GetDefaultParent(window);
+ return RootWindow::GetInstance();
+}
+
+} // namespace
+
Window::Window(WindowDelegate* delegate)
: type_(WINDOW_TYPE_UNKNOWN),
delegate_(delegate),
@@ -153,12 +165,7 @@
}
void Window::SetParent(Window* parent) {
- if (parent)
- parent->AddChild(this);
- else if (RootWindow::GetInstance()->stacking_client())
- RootWindow::GetInstance()->stacking_client()->AddChildToDefaultParent(this);
- else
- NOTREACHED();
+ GetParentForWindow(this, parent)->AddChild(this);
}
void Window::StackChildAtTop(Window* child) {
« no previous file with comments | « ui/aura/test/test_stacking_client.cc ('k') | ui/aura_shell/root_window_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698