| 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..a4244bdbb1f42e3dc932cc114c5d9872d8715317 100644
|
| --- a/ui/wm/core/window_util.cc
|
| +++ b/ui/wm/core/window_util.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "ui/wm/core/window_util.h"
|
|
|
| +#include "base/memory/ptr_util.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/compositor/layer.h"
|
| #include "ui/compositor/layer_tree_owner.h"
|
| @@ -37,6 +38,24 @@ 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,
|
| + bool sync_bounds) {
|
| + for (auto* child : to_mirror->children()) {
|
| + child->set_sync_bounds(sync_bounds);
|
| + ui::Layer* mirror = child->Mirror().release();
|
| + if (factory && child->delegate())
|
| + mirror->set_delegate(factory->CreateDelegate(mirror, child));
|
| + parent->Add(mirror);
|
| + MirrorChildren(child, mirror, factory, sync_bounds);
|
| + }
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace wm {
|
| @@ -88,8 +107,7 @@ aura::Window* GetToplevelWindow(aura::Window* window) {
|
| std::unique_ptr<ui::LayerTreeOwner> RecreateLayers(
|
| ui::LayerOwner* root,
|
| LayerDelegateFactory* factory) {
|
| - std::unique_ptr<ui::LayerTreeOwner> old_layer(
|
| - new ui::LayerTreeOwner(root->RecreateLayer().release()));
|
| + auto old_layer = base::MakeUnique<ui::LayerTreeOwner>(root->RecreateLayer());
|
| if (old_layer->root()) {
|
| if (factory) {
|
| old_layer->root()->set_delegate(
|
| @@ -100,6 +118,19 @@ std::unique_ptr<ui::LayerTreeOwner> RecreateLayers(
|
| return old_layer;
|
| }
|
|
|
| +std::unique_ptr<ui::LayerTreeOwner> MirrorLayers(
|
| + ui::LayerOwner* root,
|
| + LayerDelegateFactory* factory,
|
| + bool sync_bounds) {
|
| + auto mirror = base::MakeUnique<ui::LayerTreeOwner>(root->layer()->Mirror());
|
| + if (factory) {
|
| + mirror->root()->set_delegate(
|
| + factory->CreateDelegate(mirror->root(), root->layer()));
|
| + }
|
| + MirrorChildren(root->layer(), mirror->root(), factory, sync_bounds);
|
| + return mirror;
|
| +}
|
| +
|
| aura::Window* GetTransientParent(aura::Window* window) {
|
| return const_cast<aura::Window*>(GetTransientParent(
|
| const_cast<const aura::Window*>(window)));
|
|
|