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

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

Issue 2694213003: mash: wires up shadows for mash (Closed)
Patch Set: defaults test Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/wm/core/shadow.cc ('k') | ui/wm/core/shadow_types.h » ('j') | 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 c236879ac375e1fb0cbc12627c56ab4805009896..bce9beac84feaa17a4fd02ed883c1bdc419f3208 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 GetShadowElevationConvertDefault(aura::Window* window) {
+ 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 GetShadowElevationConvertDefault(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) {
+ GetShadowElevationConvertDefault(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>(GetShadowElevationConvertDefault(window)) > 0;
}
void ShadowController::Impl::HandlePossibleShadowVisibilityChange(
« no previous file with comments | « ui/wm/core/shadow.cc ('k') | ui/wm/core/shadow_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698