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

Unified Diff: ash/wm/window_mirror_view.cc

Issue 2254733003: Add ui::LayerObserver and use it to update Alt+Tab previews as needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: appease compiler Created 4 years, 4 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/window_mirror_view.cc
diff --git a/ash/wm/window_mirror_view.cc b/ash/wm/window_mirror_view.cc
index 374207c1c61cc35bec7ca4d259119404fcc4ffd2..b43207e040a626cafb7c5303692abd218cffd529 100644
--- a/ash/wm/window_mirror_view.cc
+++ b/ash/wm/window_mirror_view.cc
@@ -30,9 +30,11 @@ void EnsureAllChildrenAreVisible(ui::Layer* layer) {
} // namespace
-WindowMirrorView::WindowMirrorView(WmWindowAura* window) : target_(window) {
+WindowMirrorView::WindowMirrorView(WmWindowAura* window)
+ : target_(window), scoped_observer_(this) {
DCHECK(window);
}
+
WindowMirrorView::~WindowMirrorView() {}
gfx::Size WindowMirrorView::GetPreferredSize() const {
@@ -79,10 +81,22 @@ ui::LayerDelegate* WindowMirrorView::CreateDelegate(
return delegates_.back().get();
}
+void WindowMirrorView::OnDelegatedFrameDamageInTree() {
+ layer_owner_.reset();
+ if (!GetVisibleBounds().IsEmpty())
+ InitLayerOwner();
+}
+
+void WindowMirrorView::OnLayerDestroyed(ui::Layer* layer) {
+ scoped_observer_.Remove(layer);
+}
+
void WindowMirrorView::InitLayerOwner() {
SetPaintToLayer(true);
+ scoped_observer_.RemoveAll();
layer_owner_ = ::wm::RecreateLayers(target_->aura_window(), this);
+ scoped_observer_.Add(target_->aura_window()->layer());
GetMirrorLayer()->parent()->Remove(GetMirrorLayer());
layer()->Add(GetMirrorLayer());
« no previous file with comments | « ash/wm/window_mirror_view.h ('k') | ui/compositor/BUILD.gn » ('j') | ui/compositor/layer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698