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

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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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