| Index: ui/wm/core/window_util.cc
|
| diff --git a/ui/wm/core/window_util.cc b/ui/wm/core/window_util.cc
|
| index 39fa162969b966ccbbee172c43f5c6cde6b85117..0dc44d50da993b8a289b2f4ce15f04b240662d9c 100644
|
| --- a/ui/wm/core/window_util.cc
|
| +++ b/ui/wm/core/window_util.cc
|
| @@ -4,7 +4,6 @@
|
|
|
| #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"
|
| @@ -17,7 +16,9 @@
|
| // cloned children to |parent|.
|
| //
|
| // WARNING: It is assumed that |parent| is ultimately owned by a LayerTreeOwner.
|
| -void CloneChildren(ui::Layer* to_clone, ui::Layer* parent) {
|
| +void CloneChildren(ui::Layer* to_clone,
|
| + ui::Layer* parent,
|
| + wm::LayerDelegateFactory* factory) {
|
| typedef std::vector<ui::Layer*> Layers;
|
| // Make a copy of the children since RecreateLayer() mutates it.
|
| Layers children(to_clone->children());
|
| @@ -25,26 +26,14 @@
|
| ui::LayerOwner* owner = (*i)->owner();
|
| ui::Layer* old_layer = owner ? owner->RecreateLayer().release() : NULL;
|
| if (old_layer) {
|
| + if (factory && owner->layer()->delegate())
|
| + old_layer->set_delegate(
|
| + factory->CreateDelegate(old_layer, owner->layer()));
|
| parent->Add(old_layer);
|
| // RecreateLayer() moves the existing children to the new layer. Create a
|
| // copy of those.
|
| - CloneChildren(owner->layer(), old_layer);
|
| + CloneChildren(owner->layer(), old_layer, factory);
|
| }
|
| - }
|
| -}
|
| -
|
| -// 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,
|
| - bool sync_bounds) {
|
| - for (auto* child : to_mirror->children()) {
|
| - child->set_sync_bounds(sync_bounds);
|
| - ui::Layer* mirror = child->Mirror().release();
|
| - parent->Add(mirror);
|
| - MirrorChildren(child, mirror, sync_bounds);
|
| }
|
| }
|
|
|
| @@ -96,18 +85,19 @@
|
| return client ? client->GetToplevelWindow(window) : NULL;
|
| }
|
|
|
| -std::unique_ptr<ui::LayerTreeOwner> RecreateLayers(ui::LayerOwner* root) {
|
| - DCHECK(root->OwnsLayer());
|
| - auto old_layer = base::MakeUnique<ui::LayerTreeOwner>(root->RecreateLayer());
|
| - CloneChildren(root->layer(), old_layer->root());
|
| +std::unique_ptr<ui::LayerTreeOwner> RecreateLayers(
|
| + ui::LayerOwner* root,
|
| + LayerDelegateFactory* factory) {
|
| + std::unique_ptr<ui::LayerTreeOwner> old_layer(
|
| + new ui::LayerTreeOwner(root->RecreateLayer().release()));
|
| + if (old_layer->root()) {
|
| + if (factory) {
|
| + old_layer->root()->set_delegate(
|
| + factory->CreateDelegate(old_layer->root(), root->layer()));
|
| + }
|
| + CloneChildren(root->layer(), old_layer->root(), factory);
|
| + }
|
| return old_layer;
|
| -}
|
| -
|
| -std::unique_ptr<ui::LayerTreeOwner> MirrorLayers(
|
| - ui::LayerOwner* root, bool sync_bounds) {
|
| - auto mirror = base::MakeUnique<ui::LayerTreeOwner>(root->layer()->Mirror());
|
| - MirrorChildren(root->layer(), mirror->root(), sync_bounds);
|
| - return mirror;
|
| }
|
|
|
| aura::Window* GetTransientParent(aura::Window* window) {
|
|
|