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

Side by Side 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: fix for other test 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 unified diff | Download patch
« no previous file with comments | « ash/wm/window_mirror_view.h ('k') | ui/compositor/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/window_mirror_view.h" 5 #include "ash/wm/window_mirror_view.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/wm/forwarding_layer_delegate.h" 8 #include "ash/common/wm/forwarding_layer_delegate.h"
9 #include "ash/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
10 #include "ash/wm/window_state_aura.h" 10 #include "ash/wm/window_state_aura.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 bool WindowMirrorView::GetNeedsNotificationWhenVisibleBoundsChange() const { 68 bool WindowMirrorView::GetNeedsNotificationWhenVisibleBoundsChange() const {
69 return true; 69 return true;
70 } 70 }
71 71
72 void WindowMirrorView::OnVisibleBoundsChanged() { 72 void WindowMirrorView::OnVisibleBoundsChanged() {
73 if (!layer_owner_ && !GetVisibleBounds().IsEmpty()) 73 if (!layer_owner_ && !GetVisibleBounds().IsEmpty())
74 InitLayerOwner(); 74 InitLayerOwner();
75 } 75 }
76 76
77 ui::LayerDelegate* WindowMirrorView::CreateDelegate( 77 ui::LayerDelegate* WindowMirrorView::CreateDelegate(ui::Layer* new_layer,
78 ui::LayerDelegate* delegate) { 78 ui::Layer* old_layer) {
79 if (!delegate) 79 if (!old_layer || !old_layer->delegate())
80 return nullptr; 80 return nullptr;
81 delegates_.push_back( 81 delegates_.push_back(
82 base::MakeUnique<ForwardingLayerDelegate>(target_, delegate)); 82 base::MakeUnique<ForwardingLayerDelegate>(new_layer, old_layer));
83
84 return delegates_.back().get(); 83 return delegates_.back().get();
85 } 84 }
86 85
87 void WindowMirrorView::InitLayerOwner() { 86 void WindowMirrorView::InitLayerOwner() {
88 if (!layer_owner_) { 87 if (!layer_owner_) {
89 target_->aura_window()->SetProperty(aura::client::kMirroringEnabledKey, 88 target_->aura_window()->SetProperty(aura::client::kMirroringEnabledKey,
90 true); 89 true);
91 } 90 }
92 91
93 layer_owner_ = ::wm::RecreateLayers(target_->aura_window(), this); 92 layer_owner_ = ::wm::RecreateLayers(target_->aura_window(), this);
(...skipping 20 matching lines...) Expand all
114 gfx::Rect WindowMirrorView::GetClientAreaBounds() const { 113 gfx::Rect WindowMirrorView::GetClientAreaBounds() const {
115 // The target window may not have a widget in unit tests. 114 // The target window may not have a widget in unit tests.
116 if (!target_->GetInternalWidget()) 115 if (!target_->GetInternalWidget())
117 return gfx::Rect(); 116 return gfx::Rect();
118 views::View* client_view = target_->GetInternalWidget()->client_view(); 117 views::View* client_view = target_->GetInternalWidget()->client_view();
119 return client_view->ConvertRectToWidget(client_view->GetLocalBounds()); 118 return client_view->ConvertRectToWidget(client_view->GetLocalBounds());
120 } 119 }
121 120
122 } // namespace wm 121 } // namespace wm
123 } // namespace ash 122 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_mirror_view.h ('k') | ui/compositor/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698