Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: ui/aura/window.cc

Issue 10444014: ash: Improved window maximize/restore animations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix workspace mgr, remove ignore_window, cleanup Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/aura/window.cc
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index d5ad4acc32ba5e786a7cacb12b744a24ece1948a..40752da36059b0ab8279db3e0499fdd9736218e3 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -146,6 +146,33 @@ void Window::Init(ui::LayerType layer_type) {
Env::GetInstance()->NotifyWindowInitialized(this);
}
+ui::Layer* Window::RecreateLayer() {
+ // Disconnect the old layer, but don't delete it.
+ ui::Layer* old_layer = AcquireLayer();
+ old_layer->set_delegate(NULL);
+ layer_ = new ui::Layer(old_layer->type());
+ layer_owner_.reset(layer_);
+ layer_->SetVisible(old_layer->visible());
+ layer_->set_delegate(this);
+ UpdateLayerName(name_);
+ layer_->SetFillsBoundsOpaquely(!transparent_);
+ // Install new layer as a sibling of the old layer, stacked on top of it.
+ if (old_layer->parent()) {
+ old_layer->parent()->Add(layer_);
+ old_layer->parent()->StackAbove(layer_, old_layer);
+ }
+ // Migrate all the child layers over to the new layer. Copy the list because
+ // the items are removed during iteration.
+ std::vector<ui::Layer*> children_copy = old_layer->children();
+ for (std::vector<ui::Layer*>::const_iterator it = children_copy.begin();
+ it != children_copy.end();
+ ++it) {
+ ui::Layer* child = *it;
+ layer_->Add(child);
+ }
+ return old_layer;
+}
+
void Window::SetType(client::WindowType type) {
// Cannot change type after the window is initialized.
DCHECK(!layer());

Powered by Google App Engine
This is Rietveld 408576698