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

Side by Side Diff: ash/wm/window_mirror_view.cc

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor Created 3 years, 11 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
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/common/wm/window_state.h" 7 #include "ash/common/wm/window_state.h"
8 #include "ash/common/wm_window.h" 8 #include "ash/common/wm_window.h"
9 #include "ash/common/wm_window_property.h" 9 #include "ash/common/wm_window_property.h"
10 #include "ash/wm/window_state_aura.h" 10 #include "ash/wm/window_state_aura.h"
11 #include "ui/aura/client/aura_constants.h" 11 #include "ui/aura/client/aura_constants.h"
12 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
13 #include "ui/compositor/layer.h" 13 #include "ui/compositor/layer.h"
14 #include "ui/compositor/layer_tree_owner.h" 14 #include "ui/compositor/layer_tree_owner.h"
15 #include "ui/compositor/layer_type.h"
15 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
16 #include "ui/wm/core/window_util.h" 17 #include "ui/wm/core/window_util.h"
17 18
18 namespace ash { 19 namespace ash {
19 namespace wm { 20 namespace wm {
20 namespace { 21 namespace {
21 22
22 void EnsureAllChildrenAreVisible(ui::Layer* layer) { 23 void EnsureAllChildrenAreVisible(ui::Layer* layer) {
23 std::list<ui::Layer*> layers; 24 std::list<ui::Layer*> layers;
24 layers.push_back(layer); 25 layers.push_back(layer);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 80
80 void WindowMirrorView::InitLayerOwner() { 81 void WindowMirrorView::InitLayerOwner() {
81 if (!layer_owner_) { 82 if (!layer_owner_) {
82 target_->aura_window()->SetProperty(aura::client::kMirroringEnabledKey, 83 target_->aura_window()->SetProperty(aura::client::kMirroringEnabledKey,
83 true); 84 true);
84 } 85 }
85 86
86 layer_owner_ = 87 layer_owner_ =
87 ::wm::MirrorLayers(target_->aura_window(), false /* sync_bounds */); 88 ::wm::MirrorLayers(target_->aura_window(), false /* sync_bounds */);
88 89
89 SetPaintToLayer(true); 90 SetPaintToLayer(ui::LAYER_TEXTURED);
90 layer()->Add(GetMirrorLayer()); 91 layer()->Add(GetMirrorLayer());
91 // This causes us to clip the non-client areas of the window. 92 // This causes us to clip the non-client areas of the window.
92 layer()->SetMasksToBounds(true); 93 layer()->SetMasksToBounds(true);
93 94
94 // Some extra work is needed when the target window is minimized. 95 // Some extra work is needed when the target window is minimized.
95 if (target_->GetWindowState()->IsMinimized()) { 96 if (target_->GetWindowState()->IsMinimized()) {
96 GetMirrorLayer()->SetOpacity(1); 97 GetMirrorLayer()->SetOpacity(1);
97 EnsureAllChildrenAreVisible(GetMirrorLayer()); 98 EnsureAllChildrenAreVisible(GetMirrorLayer());
98 } 99 }
99 100
(...skipping 13 matching lines...) Expand all
113 } 114 }
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698