| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/common/wm/window_resizer.h" | 9 #include "ash/common/wm/window_resizer.h" |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| (...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 // Ensure the background area inside the shadow is solid black. | 1248 // Ensure the background area inside the shadow is solid black. |
| 1249 // Clients that provide translucent contents should not be using | 1249 // Clients that provide translucent contents should not be using |
| 1250 // rectangular shadows as this method requires opaque contents to | 1250 // rectangular shadows as this method requires opaque contents to |
| 1251 // cast a shadow that represent it correctly. | 1251 // cast a shadow that represent it correctly. |
| 1252 shadow_underlay_->Init(ui::LAYER_SOLID_COLOR); | 1252 shadow_underlay_->Init(ui::LAYER_SOLID_COLOR); |
| 1253 shadow_underlay_->layer()->SetColor(SK_ColorBLACK); | 1253 shadow_underlay_->layer()->SetColor(SK_ColorBLACK); |
| 1254 DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely()); | 1254 DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely()); |
| 1255 window->AddChild(shadow_underlay_); | 1255 window->AddChild(shadow_underlay_); |
| 1256 window->StackChildAtBottom(shadow_underlay_); | 1256 window->StackChildAtBottom(shadow_underlay_); |
| 1257 } | 1257 } |
| 1258 shadow_underlay_->layer()->SetOpacity( | 1258 |
| 1259 rectangular_shadow_background_opacity_); | 1259 // Put the black background layer behind the window if |
| 1260 shadow_underlay_->SetBounds(shadow_bounds); | 1260 // 1) the window is in immersive fullscreen. |
| 1261 // 2) the window can control the bounds of the window in fullscreen ( |
| 1262 // thus the background can be visible). |
| 1263 // 3) the window has no transform (the transformed background may |
| 1264 // not cover the entire background, e.g. overview mode). |
| 1265 if (widget_->IsFullscreen() && |
| 1266 ash::wm::GetWindowState(window)->allow_set_bounds_in_maximized() && |
| 1267 window->layer()->transform().IsIdentity()) { |
| 1268 gfx::Point origin; |
| 1269 origin -= window->bounds().origin().OffsetFromOrigin(); |
| 1270 gfx::Rect background_bounds(origin, window->parent()->bounds().size()); |
| 1271 shadow_underlay_->SetBounds(background_bounds); |
| 1272 shadow_underlay_->layer()->SetOpacity(1.f); |
| 1273 } else { |
| 1274 shadow_underlay_->SetBounds(shadow_bounds); |
| 1275 shadow_underlay_->layer()->SetOpacity( |
| 1276 rectangular_shadow_background_opacity_); |
| 1277 } |
| 1261 shadow_underlay_->Show(); | 1278 shadow_underlay_->Show(); |
| 1262 | 1279 |
| 1263 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); | 1280 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); |
| 1264 // Maximized/Fullscreen window does not create a shadow. | 1281 // Maximized/Fullscreen window does not create a shadow. |
| 1265 if (!shadow) | 1282 if (!shadow) |
| 1266 return; | 1283 return; |
| 1267 | 1284 |
| 1268 if (!shadow_overlay_) { | 1285 if (!shadow_overlay_) { |
| 1269 shadow_overlay_ = new aura::Window(nullptr); | 1286 shadow_overlay_ = new aura::Window(nullptr); |
| 1270 DCHECK(shadow_overlay_->owned_by_parent()); | 1287 DCHECK(shadow_overlay_->owned_by_parent()); |
| 1271 shadow_overlay_->set_ignore_events(true); | 1288 shadow_overlay_->set_ignore_events(true); |
| 1272 shadow_overlay_->Init(ui::LAYER_NOT_DRAWN); | 1289 shadow_overlay_->Init(ui::LAYER_NOT_DRAWN); |
| 1273 shadow_overlay_->layer()->Add(shadow->layer()); | 1290 shadow_overlay_->layer()->Add(shadow->layer()); |
| 1274 window->AddChild(shadow_overlay_); | 1291 window->AddChild(shadow_overlay_); |
| 1275 shadow_overlay_->Show(); | 1292 shadow_overlay_->Show(); |
| 1276 } | 1293 } |
| 1277 shadow_overlay_->SetBounds(shadow_bounds); | 1294 shadow_overlay_->SetBounds(shadow_bounds); |
| 1278 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); | 1295 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); |
| 1279 } | 1296 } |
| 1280 } | 1297 } |
| 1281 | 1298 |
| 1282 } // namespace exo | 1299 } // namespace exo |
| OLD | NEW |