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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void WindowMirrorView::OnVisibleBoundsChanged() { | 67 void WindowMirrorView::OnVisibleBoundsChanged() { |
68 if (!layer_owner_ && !GetVisibleBounds().IsEmpty()) | 68 if (!layer_owner_ && !GetVisibleBounds().IsEmpty()) |
69 InitLayerOwner(); | 69 InitLayerOwner(); |
70 } | 70 } |
71 | 71 |
72 ui::LayerDelegate* WindowMirrorView::CreateDelegate( | 72 ui::LayerDelegate* WindowMirrorView::CreateDelegate( |
73 ui::LayerDelegate* delegate) { | 73 ui::LayerDelegate* delegate) { |
74 if (!delegate) | 74 if (!delegate) |
75 return nullptr; | 75 return nullptr; |
76 delegates_.push_back( | 76 delegates_.push_back( |
77 base::WrapUnique(new ForwardingLayerDelegate(target_, delegate))); | 77 base::MakeUnique<ForwardingLayerDelegate>(target_, delegate)); |
78 | 78 |
79 return delegates_.back().get(); | 79 return delegates_.back().get(); |
80 } | 80 } |
81 | 81 |
82 void WindowMirrorView::InitLayerOwner() { | 82 void WindowMirrorView::InitLayerOwner() { |
83 SetPaintToLayer(true); | 83 SetPaintToLayer(true); |
84 | 84 |
85 layer_owner_ = ::wm::RecreateLayers(target_->aura_window(), this); | 85 layer_owner_ = ::wm::RecreateLayers(target_->aura_window(), this); |
86 | 86 |
87 GetMirrorLayer()->parent()->Remove(GetMirrorLayer()); | 87 GetMirrorLayer()->parent()->Remove(GetMirrorLayer()); |
(...skipping 18 matching lines...) Expand all Loading... |
106 gfx::Rect WindowMirrorView::GetClientAreaBounds() const { | 106 gfx::Rect WindowMirrorView::GetClientAreaBounds() const { |
107 // The target window may not have a widget in unit tests. | 107 // The target window may not have a widget in unit tests. |
108 if (!target_->GetInternalWidget()) | 108 if (!target_->GetInternalWidget()) |
109 return gfx::Rect(); | 109 return gfx::Rect(); |
110 views::View* client_view = target_->GetInternalWidget()->client_view(); | 110 views::View* client_view = target_->GetInternalWidget()->client_view(); |
111 return client_view->ConvertRectToWidget(client_view->GetLocalBounds()); | 111 return client_view->ConvertRectToWidget(client_view->GetLocalBounds()); |
112 } | 112 } |
113 | 113 |
114 } // namespace wm | 114 } // namespace wm |
115 } // namespace ash | 115 } // namespace ash |
OLD | NEW |