| 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..39fa162969b966ccbbee172c43f5c6cde6b85117 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"
|
| @@ -16,9 +17,7 @@ namespace {
|
| // 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,
|
| - wm::LayerDelegateFactory* factory) {
|
| +void CloneChildren(ui::Layer* to_clone, ui::Layer* parent) {
|
| typedef std::vector<ui::Layer*> Layers;
|
| // Make a copy of the children since RecreateLayer() mutates it.
|
| Layers children(to_clone->children());
|
| @@ -26,17 +25,29 @@ void CloneChildren(ui::Layer* to_clone,
|
| 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, factory);
|
| + CloneChildren(owner->layer(), old_layer);
|
| }
|
| }
|
| }
|
|
|
| +// 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);
|
| + }
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace wm {
|
| @@ -85,21 +96,20 @@ aura::Window* GetToplevelWindow(aura::Window* window) {
|
| return client ? client->GetToplevelWindow(window) : NULL;
|
| }
|
|
|
| -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);
|
| - }
|
| +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());
|
| 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) {
|
| return const_cast<aura::Window*>(GetTransientParent(
|
| const_cast<const aura::Window*>(window)));
|
|
|