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

Unified Diff: ash/wm/drag_window_controller.cc

Issue 2383263002: Generalize layer mirroring for phantom windows (Closed)
Patch Set: Created 4 years, 3 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: ash/wm/drag_window_controller.cc
diff --git a/ash/wm/drag_window_controller.cc b/ash/wm/drag_window_controller.cc
index fb6bc25cf677e44f7384d95fd00d60a68bc4538a..88e11ff8345fa05cffa815807b339629152e14f2 100644
--- a/ash/wm/drag_window_controller.cc
+++ b/ash/wm/drag_window_controller.cc
@@ -58,6 +58,7 @@ class DragWindowController::DragWindowDetails
// when it becomes necessary again.
DCHECK(!drag_window_);
layer_owner_.reset();
+ delegates_.clear(); // Stop observing layers.
oshima 2016/10/04 21:06:31 thanks for catching this. i believe this fixes the
return;
}
if (!drag_window_)
@@ -115,6 +116,7 @@ class DragWindowController::DragWindowDetails
void RecreateWindowLayers(aura::Window* original_window) {
DCHECK(!layer_owner_.get());
+ sync_bounds_ = false;
layer_owner_ = ::wm::RecreateLayers(original_window, this);
// Place the layer at (0, 0) of the DragWindowController's window.
gfx::Rect layer_bounds = layer_owner_->root()->bounds();
@@ -132,12 +134,14 @@ class DragWindowController::DragWindowDetails
layer_owner_->root()->SetOpacity(1.0f);
}
- // aura::WindowDelegate:
- ui::LayerDelegate* CreateDelegate(ui::Layer* foo, ui::Layer* layer) override {
+ // wm::LayerDelegateFactory:
+ ui::LayerDelegate* CreateDelegate(ui::Layer* new_layer,
+ ui::Layer* layer) override {
if (!layer || !layer->delegate())
return nullptr;
wm::ForwardingLayerDelegate* new_delegate =
- new wm::ForwardingLayerDelegate(foo, layer);
+ new wm::ForwardingLayerDelegate(new_layer, layer, sync_bounds_);
+ sync_bounds_ = true;
delegates_.push_back(base::WrapUnique(new_delegate));
return new_delegate;
}
@@ -176,6 +180,7 @@ class DragWindowController::DragWindowDetails
aura::Window* drag_window_ = nullptr; // Owned by the container.
aura::Window* original_window_ = nullptr;
+ bool sync_bounds_; // Used during cloning. True for all layers but the root.
std::vector<std::unique_ptr<wm::ForwardingLayerDelegate>> delegates_;

Powered by Google App Engine
This is Rietveld 408576698