Chromium Code Reviews| Index: ui/wm/core/window_util.cc |
| diff --git a/ui/wm/core/window_util.cc b/ui/wm/core/window_util.cc |
| index 0dc44d50da993b8a289b2f4ce15f04b240662d9c..7d61450325110f572be1f6d84bb6b9dffe90822a 100644 |
| --- a/ui/wm/core/window_util.cc |
| +++ b/ui/wm/core/window_util.cc |
| @@ -37,6 +37,23 @@ void CloneChildren(ui::Layer* to_clone, |
| } |
| } |
| +// Invokes Mirror() on all the children of |to_mirror|, adding the newly cloned |
| +// children to |parent|. |
| +// |
| +// WARNING: It is assumed that |parent| is ultimately owned by a LayerTreeOwner. |
| +void MirrorChildren(ui::Layer* to_mirror, |
| + ui::Layer* parent, |
| + wm::LayerDelegateFactory* factory) { |
| + for (auto* child : to_mirror->children()) { |
| + ui::Layer* mirror = child->Mirror().release(); |
| + mirror->set_sync_bounds(true); |
| + if (factory && child->delegate()) |
| + mirror->set_delegate(factory->CreateDelegate(mirror, child)); |
| + parent->Add(mirror); |
| + MirrorChildren(child, mirror, factory); |
| + } |
| +} |
| + |
| } // namespace |
| namespace wm { |
| @@ -100,6 +117,19 @@ std::unique_ptr<ui::LayerTreeOwner> RecreateLayers( |
| return old_layer; |
| } |
| +std::unique_ptr<ui::LayerTreeOwner> MirrorLayers( |
| + ui::LayerOwner* root, |
| + LayerDelegateFactory* factory) { |
| + std::unique_ptr<ui::LayerTreeOwner> mirror( |
| + new ui::LayerTreeOwner(root->layer()->Mirror().release())); |
|
sky
2016/10/13 19:21:33
MakeUnique.
optional: using the release here is aw
Dominik Laskowski
2016/10/13 22:19:39
Done.
|
| + if (factory) { |
| + mirror->root()->set_delegate( |
| + factory->CreateDelegate(mirror->root(), root->layer())); |
| + } |
| + MirrorChildren(root->layer(), mirror->root(), factory); |
| + return mirror; |
| +} |
| + |
| aura::Window* GetTransientParent(aura::Window* window) { |
| return const_cast<aura::Window*>(GetTransientParent( |
| const_cast<const aura::Window*>(window))); |