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

Unified Diff: ui/wm/core/shadow_controller.cc

Issue 2555373004: Apply new MD shadows to CrOS tray bubbles. (Closed)
Patch Set: comment Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/wm/core/shadow.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « ui/wm/core/shadow.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698