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 48004100f6aa146cb6603f50e25ba6c8d51cdbbb..ce30bbdabc8f504929fca934eefd2919ef413d95 100644 |
| --- a/ui/wm/core/shadow_controller.cc |
| +++ b/ui/wm/core/shadow_controller.cc |
| @@ -45,20 +45,22 @@ ShadowType GetShadowTypeFromWindow(aura::Window* window) { |
| return SHADOW_TYPE_NONE; |
| } |
| -bool ShouldUseSmallShadowForWindow(aura::Window* window) { |
| +Shadow::Style GetShadowStyleForWindow(aura::Window* window) { |
| switch (window->type()) { |
| case ui::wm::WINDOW_TYPE_MENU: |
| case ui::wm::WINDOW_TYPE_TOOLTIP: |
| - return true; |
| + return Shadow::STYLE_SMALL; |
| + |
| + // System tray bubbles render like active windows. TODO(estade): this |
| + // mechanism will need to be revisited for applying WM shadows to other |
| + // types of bubbles which don't want to render such large shadows. |
| + case ui::wm::WINDOW_TYPE_POPUP: |
| + return Shadow::STYLE_ACTIVE; |
|
James Cook
2016/12/10 00:19:16
This still concerns me. You're relying on the fact
Evan Stade
2016/12/12 17:51:20
I don't think that's an unreasonable assumption. I
James Cook
2016/12/12 18:33:07
I meant, how does the code work today to paint the
sky
2016/12/12 19:16:53
Bubbles are mapped to ui::wm::WINDOW_TYPE_POPUP, w
Evan Stade
2016/12/12 21:28:40
They don't get wm shadows at all currently. With t
|
| + |
| default: |
| - break; |
| + return IsActiveWindow(window) ? Shadow::STYLE_ACTIVE |
| + : Shadow::STYLE_INACTIVE; |
| } |
| - return false; |
| -} |
| - |
| -Shadow::Style GetShadowStyleForWindow(aura::Window* window) { |
| - return ShouldUseSmallShadowForWindow(window) ? Shadow::STYLE_SMALL : |
| - (IsActiveWindow(window) ? Shadow::STYLE_ACTIVE : Shadow::STYLE_INACTIVE); |
| } |
| // Returns the shadow style to be applied to |losing_active| when it is losing |
| @@ -193,12 +195,13 @@ void ShadowController::Impl::OnWindowActivated(ActivationReason reason, |
| aura::Window* lost_active) { |
| if (gained_active) { |
| Shadow* shadow = GetShadowForWindow(gained_active); |
| - if (shadow && !ShouldUseSmallShadowForWindow(gained_active)) |
| - shadow->SetStyle(Shadow::STYLE_ACTIVE); |
| + if (shadow) |
| + shadow->SetStyle(GetShadowStyleForWindow(gained_active)); |
| } |
| if (lost_active) { |
| Shadow* shadow = GetShadowForWindow(lost_active); |
| - if (shadow && !ShouldUseSmallShadowForWindow(lost_active)) { |
| + if (shadow && |
| + GetShadowStyleForWindow(lost_active) == Shadow::STYLE_INACTIVE) { |
| shadow->SetStyle(GetShadowStyleForWindowLosingActive(lost_active, |
| gained_active)); |
| } |