OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shadow_controller.h" | 5 #include "ash/wm/shadow_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/shadow.h" | 10 #include "ash/wm/shadow.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 if (shadow) | 155 if (shadow) |
156 shadow->layer()->SetVisible(should_show); | 156 shadow->layer()->SetVisible(should_show); |
157 else if (should_show && !shadow) | 157 else if (should_show && !shadow) |
158 CreateShadowForWindow(window); | 158 CreateShadowForWindow(window); |
159 } | 159 } |
160 | 160 |
161 void ShadowController::CreateShadowForWindow(aura::Window* window) { | 161 void ShadowController::CreateShadowForWindow(aura::Window* window) { |
162 linked_ptr<Shadow> shadow(new Shadow()); | 162 linked_ptr<Shadow> shadow(new Shadow()); |
163 window_shadows_.insert(make_pair(window, shadow)); | 163 window_shadows_.insert(make_pair(window, shadow)); |
164 | 164 |
165 shadow->Init(window, | 165 shadow->Init(ShouldUseSmallShadowForWindow(window) ? |
166 ShouldUseSmallShadowForWindow(window) ? | |
167 Shadow::STYLE_SMALL : Shadow::STYLE_ACTIVE); | 166 Shadow::STYLE_SMALL : Shadow::STYLE_ACTIVE); |
168 shadow->SetContentBounds(gfx::Rect(window->bounds().size())); | 167 shadow->SetContentBounds(gfx::Rect(window->bounds().size())); |
169 shadow->layer()->SetVisible(ShouldShowShadowForWindow(window)); | 168 shadow->layer()->SetVisible(ShouldShowShadowForWindow(window)); |
170 window->layer()->Add(shadow->layer()); | 169 window->layer()->Add(shadow->layer()); |
171 } | 170 } |
172 | 171 |
173 } // namespace internal | 172 } // namespace internal |
174 } // namespace ash | 173 } // namespace ash |
OLD | NEW |