| OLD | NEW |
| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(ui::Layer* new_layer, | 77 ui::LayerDelegate* WindowMirrorView::CreateDelegate(ui::Layer* new_layer, |
| 78 ui::Layer* old_layer) { | 78 ui::Layer* old_layer) { |
| 79 if (!old_layer || !old_layer->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>(new_layer, old_layer)); | 82 base::MakeUnique<ForwardingLayerDelegate>(new_layer, old_layer, |
| 83 false /* sync_bounds */)); |
| 83 return delegates_.back().get(); | 84 return delegates_.back().get(); |
| 84 } | 85 } |
| 85 | 86 |
| 86 void WindowMirrorView::InitLayerOwner() { | 87 void WindowMirrorView::InitLayerOwner() { |
| 87 if (!layer_owner_) { | 88 if (!layer_owner_) { |
| 88 target_->aura_window()->SetProperty(aura::client::kMirroringEnabledKey, | 89 target_->aura_window()->SetProperty(aura::client::kMirroringEnabledKey, |
| 89 true); | 90 true); |
| 90 } | 91 } |
| 91 | 92 |
| 92 layer_owner_ = ::wm::RecreateLayers(target_->aura_window(), this); | 93 layer_owner_ = ::wm::RecreateLayers(target_->aura_window(), this); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 113 gfx::Rect WindowMirrorView::GetClientAreaBounds() const { | 114 gfx::Rect WindowMirrorView::GetClientAreaBounds() const { |
| 114 // The target window may not have a widget in unit tests. | 115 // The target window may not have a widget in unit tests. |
| 115 if (!target_->GetInternalWidget()) | 116 if (!target_->GetInternalWidget()) |
| 116 return gfx::Rect(); | 117 return gfx::Rect(); |
| 117 views::View* client_view = target_->GetInternalWidget()->client_view(); | 118 views::View* client_view = target_->GetInternalWidget()->client_view(); |
| 118 return client_view->ConvertRectToWidget(client_view->GetLocalBounds()); | 119 return client_view->ConvertRectToWidget(client_view->GetLocalBounds()); |
| 119 } | 120 } |
| 120 | 121 |
| 121 } // namespace wm | 122 } // namespace wm |
| 122 } // namespace ash | 123 } // namespace ash |
| OLD | NEW |