| Index: ash/wm/window_util.cc
|
| diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
|
| index 0b71f068d51ab604660ca1153b99605585f1563f..070015156c7116ddf09b021e3b827ed8d1c10330 100644
|
| --- a/ash/wm/window_util.cc
|
| +++ b/ash/wm/window_util.cc
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "ash/wm/window_util.h"
|
|
|
| +#include <vector>
|
| +
|
| #include "ash/shell.h"
|
| #include "ash/wm/activation_controller.h"
|
| #include "ash/wm/window_properties.h"
|
| @@ -12,6 +14,7 @@
|
| #include "ui/aura/root_window.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/base/ui_base_types.h"
|
| +#include "ui/compositor/layer.h"
|
| #include "ui/gfx/display.h"
|
| #include "ui/gfx/screen.h"
|
|
|
| @@ -99,5 +102,35 @@ void CenterWindow(aura::Window* window) {
|
| window->SetBounds(center);
|
| }
|
|
|
| +ui::Layer* RecreateWindowLayers(aura::Window* window) {
|
| + const gfx::Rect bounds = window->bounds();
|
| + ui::Layer* old_layer = window->RecreateLayer();
|
| + DCHECK(old_layer);
|
| + // Resize the window to the new size, which will force a layout and paint.
|
| + window->SetBounds(bounds);
|
| + for (aura::Window::Windows::const_iterator it = window->children().begin();
|
| + it != window->children().end();
|
| + ++it) {
|
| + aura::Window* child = *it;
|
| + const gfx::Rect child_bounds = child->bounds();
|
| + ui::Layer* old_child_layer = RecreateWindowLayers(child);
|
| + // Maintain the hierarchy of the detached layers.
|
| + old_layer->Add(old_child_layer);
|
| + child->SetBounds(child_bounds); // Resize the child window too.
|
| + }
|
| + return old_layer;
|
| +}
|
| +
|
| +void DeepDeleteLayers(ui::Layer* layer) {
|
| + std::vector<ui::Layer*> children = layer->children();
|
| + for (std::vector<ui::Layer*>::const_iterator it = children.begin();
|
| + it != children.end();
|
| + ++it) {
|
| + ui::Layer* child = *it;
|
| + DeepDeleteLayers(child);
|
| + }
|
| + delete layer;
|
| +}
|
| +
|
| } // namespace wm
|
| } // namespace ash
|
|
|