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

Unified Diff: ash/wm/drag_window_controller.cc

Issue 2458833003: Revert of [M55] Generalize layer mirroring for phantom windows (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « ash/utility/screenshot_controller.cc ('k') | ash/wm/window_mirror_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/drag_window_controller.cc
diff --git a/ash/wm/drag_window_controller.cc b/ash/wm/drag_window_controller.cc
index 6e4add8c34a89fd676240ce7fb536172a48aed08..fb6bc25cf677e44f7384d95fd00d60a68bc4538a 100644
--- a/ash/wm/drag_window_controller.cc
+++ b/ash/wm/drag_window_controller.cc
@@ -8,6 +8,7 @@
#include "ash/aura/wm_window_aura.h"
#include "ash/common/shell_window_ids.h"
+#include "ash/common/wm/forwarding_layer_delegate.h"
#include "ash/display/window_tree_host_manager.h"
#include "ash/screen_util.h"
#include "ash/shell.h"
@@ -32,7 +33,9 @@
// This keeps track of the drag window's state. It creates/destroys/updates
// bounds and opacity based on the current bounds.
-class DragWindowController::DragWindowDetails : public aura::WindowDelegate {
+class DragWindowController::DragWindowDetails
+ : public aura::WindowDelegate,
+ public ::wm::LayerDelegateFactory {
public:
DragWindowDetails(const display::Display& display,
aura::Window* original_window)
@@ -112,12 +115,14 @@
void RecreateWindowLayers(aura::Window* original_window) {
DCHECK(!layer_owner_.get());
- layer_owner_ = ::wm::MirrorLayers(original_window, true /* sync_bounds */);
+ 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();
layer_bounds.set_origin(gfx::Point(0, 0));
layer_owner_->root()->SetBounds(layer_bounds);
layer_owner_->root()->SetVisible(false);
+ // Detach it from the current container.
+ layer_owner_->root()->parent()->Remove(layer_owner_->root());
}
void SetOpacity(const aura::Window* original_window, float opacity) {
@@ -125,6 +130,16 @@
ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator());
layer->SetOpacity(opacity);
layer_owner_->root()->SetOpacity(1.0f);
+ }
+
+ // aura::WindowDelegate:
+ ui::LayerDelegate* CreateDelegate(ui::Layer* foo, ui::Layer* layer) override {
+ if (!layer || !layer->delegate())
+ return nullptr;
+ wm::ForwardingLayerDelegate* new_delegate =
+ new wm::ForwardingLayerDelegate(foo, layer);
+ delegates_.push_back(base::WrapUnique(new_delegate));
+ return new_delegate;
}
// aura::WindowDelegate:
@@ -161,6 +176,8 @@
aura::Window* drag_window_ = nullptr; // Owned by the container.
aura::Window* original_window_ = nullptr;
+
+ std::vector<std::unique_ptr<wm::ForwardingLayerDelegate>> delegates_;
// The copy of window_->layer() and its descendants.
std::unique_ptr<ui::LayerTreeOwner> layer_owner_;
« no previous file with comments | « ash/utility/screenshot_controller.cc ('k') | ash/wm/window_mirror_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698