Chromium Code Reviews| 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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1234 // Ensure the background area inside the shadow is solid black. | 1234 // Ensure the background area inside the shadow is solid black. |
| 1235 // Clients that provide translucent contents should not be using | 1235 // Clients that provide translucent contents should not be using |
| 1236 // rectangular shadows as this method requires opaque contents to | 1236 // rectangular shadows as this method requires opaque contents to |
| 1237 // cast a shadow that represent it correctly. | 1237 // cast a shadow that represent it correctly. |
| 1238 shadow_underlay_->Init(ui::LAYER_SOLID_COLOR); | 1238 shadow_underlay_->Init(ui::LAYER_SOLID_COLOR); |
| 1239 shadow_underlay_->layer()->SetColor(SK_ColorBLACK); | 1239 shadow_underlay_->layer()->SetColor(SK_ColorBLACK); |
| 1240 DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely()); | 1240 DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely()); |
| 1241 window->AddChild(shadow_underlay_); | 1241 window->AddChild(shadow_underlay_); |
| 1242 window->StackChildAtBottom(shadow_underlay_); | 1242 window->StackChildAtBottom(shadow_underlay_); |
| 1243 } | 1243 } |
| 1244 shadow_underlay_->layer()->SetOpacity( | 1244 |
| 1245 rectangular_shadow_background_opacity_); | 1245 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); |
|
reveman
2016/08/18 16:01:21
nit: no need for this temporary variable as window
oshima
2016/08/18 16:24:01
Done.
| |
| 1246 shadow_underlay_->SetBounds(shadow_bounds); | 1246 |
| 1247 // Put the black background layer behind the window if | |
| 1248 // 1) the window is in immersive fullscreen. | |
| 1249 // 2) the window can control the bounds of the window in fullscreen ( | |
| 1250 // thus the background can be visible). | |
| 1251 // 3) the window has no transform (the transformed background may | |
| 1252 // not cover the entire background, e.g. overview mode). | |
| 1253 if (widget_->IsFullscreen() && | |
| 1254 window_state->allow_set_bounds_in_maximized() && | |
| 1255 window->layer()->transform().IsIdentity()) { | |
| 1256 gfx::Point origin; | |
| 1257 origin -= window->bounds().origin().OffsetFromOrigin(); | |
| 1258 gfx::Rect background_bounds(origin, window->parent()->bounds().size()); | |
| 1259 shadow_underlay_->SetBounds(background_bounds); | |
| 1260 shadow_underlay_->layer()->SetOpacity(1.f); | |
| 1261 } else { | |
| 1262 shadow_underlay_->SetBounds(shadow_bounds); | |
| 1263 shadow_underlay_->layer()->SetOpacity( | |
| 1264 rectangular_shadow_background_opacity_); | |
| 1265 } | |
| 1247 shadow_underlay_->Show(); | 1266 shadow_underlay_->Show(); |
| 1248 | 1267 |
| 1249 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); | 1268 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); |
| 1250 // Maximized/Fullscreen window does not create a shadow. | 1269 // Maximized/Fullscreen window does not create a shadow. |
| 1251 if (!shadow) | 1270 if (!shadow) |
| 1252 return; | 1271 return; |
| 1253 | 1272 |
| 1254 if (!shadow_overlay_) { | 1273 if (!shadow_overlay_) { |
| 1255 shadow_overlay_ = new aura::Window(nullptr); | 1274 shadow_overlay_ = new aura::Window(nullptr); |
| 1256 DCHECK(shadow_overlay_->owned_by_parent()); | 1275 DCHECK(shadow_overlay_->owned_by_parent()); |
| 1257 shadow_overlay_->set_ignore_events(true); | 1276 shadow_overlay_->set_ignore_events(true); |
| 1258 shadow_overlay_->Init(ui::LAYER_NOT_DRAWN); | 1277 shadow_overlay_->Init(ui::LAYER_NOT_DRAWN); |
| 1259 shadow_overlay_->layer()->Add(shadow->layer()); | 1278 shadow_overlay_->layer()->Add(shadow->layer()); |
| 1260 window->AddChild(shadow_overlay_); | 1279 window->AddChild(shadow_overlay_); |
| 1261 shadow_overlay_->Show(); | 1280 shadow_overlay_->Show(); |
| 1262 } | 1281 } |
| 1263 shadow_overlay_->SetBounds(shadow_bounds); | 1282 shadow_overlay_->SetBounds(shadow_bounds); |
| 1264 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); | 1283 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); |
| 1265 } | 1284 } |
| 1266 } | 1285 } |
| 1267 | 1286 |
| 1268 } // namespace exo | 1287 } // namespace exo |
| OLD | NEW |