Chromium Code Reviews| Index: components/exo/shell_surface.cc |
| diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc |
| index 10efe727153569f65763e70a2f63d143f92155cd..3d67b0ae94eb064ba286be950912abc3624bb2e9 100644 |
| --- a/components/exo/shell_surface.cc |
| +++ b/components/exo/shell_surface.cc |
| @@ -1212,10 +1212,27 @@ void ShellSurface::UpdateShadow() { |
| if (!widget_) |
| return; |
| aura::Window* window = widget_->GetNativeWindow(); |
| + ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); |
| + |
| + if (widget_->IsFullscreen() && |
|
reveman
2016/08/17 13:50:36
why do we need to do this here instead of just add
oshima
2016/08/17 15:16:12
We want to show this for all immersive fullscreen
reveman
2016/08/17 15:54:50
Yes, Id prefer if you moved it and limited this to
|
| + window_state->allow_set_bounds_in_maximized()) { |
| + if (window->layer()->transform().IsIdentity()) { |
| + wm::SetShadowType(window, wm::SHADOW_TYPE_NONE); |
| + gfx::Point origin; |
| + origin -= window->bounds().origin().OffsetFromOrigin(); |
| + gfx::Rect bounds(origin, window->parent()->bounds().size()); |
| + ShowShadowUnderlay(bounds, 1.f); |
| + } else if (shadow_underlay_) { |
| + shadow_underlay_->Hide(); |
|
reveman
2016/08/17 13:50:36
why do we need to unconditionally hide the underla
oshima
2016/08/17 15:16:12
Yes, you're right. Removed.
|
| + } |
| + return; |
| + } |
| + |
| if (shadow_content_bounds_.IsEmpty()) { |
| wm::SetShadowType(window, wm::SHADOW_TYPE_NONE); |
| if (shadow_underlay_) |
| shadow_underlay_->Hide(); |
| + |
| } else { |
| wm::SetShadowType(window, wm::SHADOW_TYPE_RECTANGULAR); |
| @@ -1227,30 +1244,12 @@ void ShellSurface::UpdateShadow() { |
| gfx::Rect shadow_bounds(shadow_origin, shadow_content_bounds_.size()); |
| // Always create and show the underlay, even in maximized/fullscreen. |
| - if (!shadow_underlay_) { |
| - shadow_underlay_ = new aura::Window(nullptr); |
| - DCHECK(shadow_underlay_->owned_by_parent()); |
| - shadow_underlay_->set_ignore_events(true); |
| - // Ensure the background area inside the shadow is solid black. |
| - // Clients that provide translucent contents should not be using |
| - // rectangular shadows as this method requires opaque contents to |
| - // cast a shadow that represent it correctly. |
| - shadow_underlay_->Init(ui::LAYER_SOLID_COLOR); |
| - shadow_underlay_->layer()->SetColor(SK_ColorBLACK); |
| - DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely()); |
| - window->AddChild(shadow_underlay_); |
| - window->StackChildAtBottom(shadow_underlay_); |
| - } |
| - shadow_underlay_->layer()->SetOpacity( |
| - rectangular_shadow_background_opacity_); |
| - shadow_underlay_->SetBounds(shadow_bounds); |
| - shadow_underlay_->Show(); |
| + ShowShadowUnderlay(shadow_bounds, rectangular_shadow_background_opacity_); |
| wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); |
| // Maximized/Fullscreen window does not create a shadow. |
| if (!shadow) |
| return; |
| - |
| if (!shadow_overlay_) { |
| shadow_overlay_ = new aura::Window(nullptr); |
| DCHECK(shadow_overlay_->owned_by_parent()); |
| @@ -1265,4 +1264,25 @@ void ShellSurface::UpdateShadow() { |
| } |
| } |
| +void ShellSurface::ShowShadowUnderlay(const gfx::Rect& bounds, float opacity) { |
| + if (!shadow_underlay_) { |
| + aura::Window* window = widget_->GetNativeWindow(); |
| + shadow_underlay_ = new aura::Window(nullptr); |
| + DCHECK(shadow_underlay_->owned_by_parent()); |
| + shadow_underlay_->set_ignore_events(true); |
| + // Ensure the background area inside the shadow is solid black. |
| + // Clients that provide translucent contents should not be using |
| + // rectangular shadows as this method requires opaque contents to |
| + // cast a shadow that represent it correctly. |
| + shadow_underlay_->Init(ui::LAYER_SOLID_COLOR); |
| + shadow_underlay_->layer()->SetColor(SK_ColorBLACK); |
| + DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely()); |
| + window->AddChild(shadow_underlay_); |
| + window->StackChildAtBottom(shadow_underlay_); |
| + } |
| + shadow_underlay_->SetBounds(bounds); |
| + shadow_underlay_->layer()->SetOpacity(opacity); |
| + shadow_underlay_->Show(); |
| +} |
| + |
| } // namespace exo |