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

Side by Side Diff: components/exo/shell_surface.cc

Issue 2251543002: Add solid black background for arc immersive fullscreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comment Created 4 years, 4 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
« no previous file with comments | « no previous file | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 // Ensure the background area inside the shadow is solid black. 1243 // Ensure the background area inside the shadow is solid black.
1244 // Clients that provide translucent contents should not be using 1244 // Clients that provide translucent contents should not be using
1245 // rectangular shadows as this method requires opaque contents to 1245 // rectangular shadows as this method requires opaque contents to
1246 // cast a shadow that represent it correctly. 1246 // cast a shadow that represent it correctly.
1247 shadow_underlay_->Init(ui::LAYER_SOLID_COLOR); 1247 shadow_underlay_->Init(ui::LAYER_SOLID_COLOR);
1248 shadow_underlay_->layer()->SetColor(SK_ColorBLACK); 1248 shadow_underlay_->layer()->SetColor(SK_ColorBLACK);
1249 DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely()); 1249 DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely());
1250 window->AddChild(shadow_underlay_); 1250 window->AddChild(shadow_underlay_);
1251 window->StackChildAtBottom(shadow_underlay_); 1251 window->StackChildAtBottom(shadow_underlay_);
1252 } 1252 }
1253 shadow_underlay_->layer()->SetOpacity( 1253
1254 rectangular_shadow_background_opacity_); 1254 // Put the black background layer behind the window if
1255 shadow_underlay_->SetBounds(shadow_bounds); 1255 // 1) the window is in immersive fullscreen.
1256 // 2) the window can control the bounds of the window in fullscreen (
1257 // thus the background can be visible).
1258 // 3) the window has no transform (the transformed background may
1259 // not cover the entire background, e.g. overview mode).
1260 if (widget_->IsFullscreen() &&
1261 ash::wm::GetWindowState(window)->allow_set_bounds_in_maximized() &&
1262 window->layer()->transform().IsIdentity()) {
1263 gfx::Point origin;
1264 origin -= window->bounds().origin().OffsetFromOrigin();
1265 gfx::Rect background_bounds(origin, window->parent()->bounds().size());
1266 shadow_underlay_->SetBounds(background_bounds);
1267 shadow_underlay_->layer()->SetOpacity(1.f);
1268 } else {
1269 shadow_underlay_->SetBounds(shadow_bounds);
1270 shadow_underlay_->layer()->SetOpacity(
1271 rectangular_shadow_background_opacity_);
1272 }
1256 shadow_underlay_->Show(); 1273 shadow_underlay_->Show();
1257 1274
1258 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); 1275 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window);
1259 // Maximized/Fullscreen window does not create a shadow. 1276 // Maximized/Fullscreen window does not create a shadow.
1260 if (!shadow) 1277 if (!shadow)
1261 return; 1278 return;
1262 1279
1263 if (!shadow_overlay_) { 1280 if (!shadow_overlay_) {
1264 shadow_overlay_ = new aura::Window(nullptr); 1281 shadow_overlay_ = new aura::Window(nullptr);
1265 DCHECK(shadow_overlay_->owned_by_parent()); 1282 DCHECK(shadow_overlay_->owned_by_parent());
1266 shadow_overlay_->set_ignore_events(true); 1283 shadow_overlay_->set_ignore_events(true);
1267 shadow_overlay_->Init(ui::LAYER_NOT_DRAWN); 1284 shadow_overlay_->Init(ui::LAYER_NOT_DRAWN);
1268 shadow_overlay_->layer()->Add(shadow->layer()); 1285 shadow_overlay_->layer()->Add(shadow->layer());
1269 window->AddChild(shadow_overlay_); 1286 window->AddChild(shadow_overlay_);
1270 shadow_overlay_->Show(); 1287 shadow_overlay_->Show();
1271 } 1288 }
1272 shadow_overlay_->SetBounds(shadow_bounds); 1289 shadow_overlay_->SetBounds(shadow_bounds);
1273 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); 1290 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size()));
1274 } 1291 }
1275 } 1292 }
1276 1293
1277 } // namespace exo 1294 } // namespace exo
OLDNEW
« no previous file with comments | « no previous file | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698