Chromium Code Reviews| Index: ash/wm/common/window_parenting_utils.cc |
| diff --git a/ash/wm/common/window_parenting_utils.cc b/ash/wm/common/window_parenting_utils.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3df723a00fc669985114235b3a509cd0ae74ed41 |
| --- /dev/null |
| +++ b/ash/wm/common/window_parenting_utils.cc |
| @@ -0,0 +1,29 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ash/wm/common/window_parenting_utils.h" |
| + |
| +#include "ash/wm/common/wm_window.h" |
| + |
| +namespace ash { |
| +namespace wm { |
| + |
| +void ReparentChildWithTransientChildren(WmWindow* child, |
| + WmWindow* old_parent, |
| + WmWindow* new_parent) { |
| + if (child->GetParent() == old_parent) |
| + new_parent->AddChild(child); |
| + ReparentTransientChildrenOfChild(child, old_parent, new_parent); |
| +} |
| + |
| +void ReparentTransientChildrenOfChild(WmWindow* child, |
| + WmWindow* old_parent, |
| + WmWindow* new_parent) { |
| + for (WmWindow* transient_child : child->GetTransientChildren()) { |
| + ReparentChildWithTransientChildren(transient_child, old_parent, new_parent); |
| + } |
|
oshima
2016/04/18 22:15:52
nit: nuke {}
sky
2016/04/20 00:08:49
Done.
|
| +} |
| + |
| +} // namespace wm |
| +} // namespace ash |