Chromium Code Reviews| Index: ui/wm/core/shadow_controller.cc |
| diff --git a/ui/wm/core/shadow_controller.cc b/ui/wm/core/shadow_controller.cc |
| index c236879ac375e1fb0cbc12627c56ab4805009896..f119adca196921677799bbbccf2870a2102ca4ef 100644 |
| --- a/ui/wm/core/shadow_controller.cc |
| +++ b/ui/wm/core/shadow_controller.cc |
| @@ -52,11 +52,20 @@ ShadowElevation GetDefaultShadowElevationForWindow(aura::Window* window) { |
| return ShadowElevation::NONE; |
| } |
| +// Returns the ShadowElevation for |window|, converting |DEFAULT| to the |
| +// appropriate ShadowElevation. |
| +ShadowElevation GetShadowElevationUseDefault(aura::Window* window) { |
|
msw
2017/02/15 01:37:29
optional nit: replace 'Use' with 'Convert', 'Looku
sky
2017/02/15 03:58:25
Done.
|
| + ShadowElevation elevation = window->GetProperty(kShadowElevationKey); |
| + return elevation == ShadowElevation::DEFAULT |
| + ? GetDefaultShadowElevationForWindow(window) |
| + : elevation; |
| +} |
| + |
| ShadowElevation GetShadowElevationForActiveState(aura::Window* window) { |
| if (IsActiveWindow(window)) |
| return kActiveNormalShadowElevation; |
| - return GetShadowElevation(window); |
| + return GetShadowElevationUseDefault(window); |
| } |
| // Returns the shadow style to be applied to |losing_active| when it is losing |
| @@ -151,7 +160,6 @@ ShadowController::Impl* ShadowController::Impl::GetInstance() { |
| void ShadowController::Impl::OnWindowInitialized(aura::Window* window) { |
| observer_manager_.Add(window); |
| - SetShadowElevation(window, GetDefaultShadowElevationForWindow(window)); |
| HandlePossibleShadowVisibilityChange(window); |
| } |
| @@ -198,7 +206,8 @@ void ShadowController::Impl::OnWindowActivated(ActivationReason reason, |
| if (lost_active) { |
| Shadow* shadow = GetShadowForWindow(lost_active); |
| if (shadow && |
| - GetShadowElevation(lost_active) == kInactiveNormalShadowElevation) { |
| + GetShadowElevationUseDefault(lost_active) == |
| + kInactiveNormalShadowElevation) { |
| shadow->SetElevation( |
| GetShadowElevationForWindowLosingActive(lost_active, gained_active)); |
| } |
| @@ -214,7 +223,7 @@ bool ShadowController::Impl::ShouldShowShadowForWindow( |
| return false; |
| } |
| - return static_cast<int>(GetShadowElevation(window)) > 0; |
| + return static_cast<int>(GetShadowElevationUseDefault(window)) > 0; |
| } |
| void ShadowController::Impl::HandlePossibleShadowVisibilityChange( |