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

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

Issue 455543004: Use ShadowController instead of creating its own. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | « athena/wm/window_overview_mode.cc ('k') | ui/wm/core/shadow_controller_unittest.cc » ('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 c809389fadbbcb2a45d50b2a44a687562c4fd4ad..67a3630839d312aeb53aca40f144e175a0a2c69a 100644
--- a/ui/wm/core/shadow_controller.cc
+++ b/ui/wm/core/shadow_controller.cc
@@ -51,12 +51,25 @@ bool ShouldUseSmallShadowForWindow(aura::Window* window) {
return false;
}
+bool IsShadowAlwaysActive(aura::Window* window) {
+ return GetShadowType(window) == SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE;
+}
+
+Shadow::Style GetShadowStyleForWindow(aura::Window* window) {
+ return ShouldUseSmallShadowForWindow(window) ? Shadow::STYLE_SMALL :
+ ((IsActiveWindow(window) || IsShadowAlwaysActive(window)) ?
+ Shadow::STYLE_ACTIVE : Shadow::STYLE_INACTIVE);
+}
+
// Returns the shadow style to be applied to |losing_active| when it is losing
// active to |gaining_active|. |gaining_active| may be of a type that hides when
// inactive, and as such we do not want to render |losing_active| as inactive.
Shadow::Style GetShadowStyleForWindowLosingActive(
aura::Window* losing_active,
aura::Window* gaining_active) {
+ if (IsShadowAlwaysActive(losing_active))
+ return Shadow::STYLE_ACTIVE;
+
if (gaining_active && aura::client::GetHideOnDeactivate(gaining_active)) {
aura::Window::Windows::const_iterator it =
std::find(GetTransientChildren(losing_active).begin(),
@@ -200,6 +213,7 @@ bool ShadowController::Impl::ShouldShowShadowForWindow(
case SHADOW_TYPE_NONE:
return false;
case SHADOW_TYPE_RECTANGULAR:
+ case SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE:
return true;
default:
NOTREACHED() << "Unknown shadow type " << type;
@@ -216,18 +230,18 @@ void ShadowController::Impl::HandlePossibleShadowVisibilityChange(
aura::Window* window) {
const bool should_show = ShouldShowShadowForWindow(window);
Shadow* shadow = GetShadowForWindow(window);
- if (shadow)
+ if (shadow) {
+ shadow->SetStyle(GetShadowStyleForWindow(window));
shadow->layer()->SetVisible(should_show);
- else if (should_show && !shadow)
+ } else if (should_show && !shadow) {
CreateShadowForWindow(window);
+ }
}
void ShadowController::Impl::CreateShadowForWindow(aura::Window* window) {
linked_ptr<Shadow> shadow(new Shadow());
window_shadows_.insert(make_pair(window, shadow));
-
- shadow->Init(ShouldUseSmallShadowForWindow(window) ?
- Shadow::STYLE_SMALL : Shadow::STYLE_ACTIVE);
+ shadow->Init(GetShadowStyleForWindow(window));
shadow->SetContentBounds(gfx::Rect(window->bounds().size()));
shadow->layer()->SetVisible(ShouldShowShadowForWindow(window));
window->layer()->Add(shadow->layer());
« no previous file with comments | « athena/wm/window_overview_mode.cc ('k') | ui/wm/core/shadow_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698