OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/wm/core/shadow_controller.h" | 5 #include "ui/wm/core/shadow_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // Returns the ShadowElevation for |window|, converting |DEFAULT| to the | 55 // Returns the ShadowElevation for |window|, converting |DEFAULT| to the |
56 // appropriate ShadowElevation. | 56 // appropriate ShadowElevation. |
57 ShadowElevation GetShadowElevationConvertDefault(aura::Window* window) { | 57 ShadowElevation GetShadowElevationConvertDefault(aura::Window* window) { |
58 ShadowElevation elevation = window->GetProperty(kShadowElevationKey); | 58 ShadowElevation elevation = window->GetProperty(kShadowElevationKey); |
59 return elevation == ShadowElevation::DEFAULT | 59 return elevation == ShadowElevation::DEFAULT |
60 ? GetDefaultShadowElevationForWindow(window) | 60 ? GetDefaultShadowElevationForWindow(window) |
61 : elevation; | 61 : elevation; |
62 } | 62 } |
63 | 63 |
64 ShadowElevation GetShadowElevationForActiveState(aura::Window* window) { | 64 ShadowElevation GetShadowElevationForActiveState(aura::Window* window) { |
| 65 ShadowElevation elevation = window->GetProperty(kShadowElevationKey); |
| 66 if (elevation != ShadowElevation::DEFAULT) |
| 67 return elevation; |
| 68 |
65 if (IsActiveWindow(window)) | 69 if (IsActiveWindow(window)) |
66 return kActiveNormalShadowElevation; | 70 return kActiveNormalShadowElevation; |
67 | 71 |
68 return GetShadowElevationConvertDefault(window); | 72 return GetDefaultShadowElevationForWindow(window); |
69 } | 73 } |
70 | 74 |
71 // Returns the shadow style to be applied to |losing_active| when it is losing | 75 // Returns the shadow style to be applied to |losing_active| when it is losing |
72 // active to |gaining_active|. |gaining_active| may be of a type that hides when | 76 // active to |gaining_active|. |gaining_active| may be of a type that hides when |
73 // inactive, and as such we do not want to render |losing_active| as inactive. | 77 // inactive, and as such we do not want to render |losing_active| as inactive. |
74 ShadowElevation GetShadowElevationForWindowLosingActive( | 78 ShadowElevation GetShadowElevationForWindowLosingActive( |
75 aura::Window* losing_active, | 79 aura::Window* losing_active, |
76 aura::Window* gaining_active) { | 80 aura::Window* gaining_active) { |
77 if (gaining_active && aura::client::GetHideOnDeactivate(gaining_active)) { | 81 if (gaining_active && aura::client::GetHideOnDeactivate(gaining_active)) { |
78 aura::Window::Windows::const_iterator it = | 82 aura::Window::Windows::const_iterator it = |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 activation_client_->RemoveObserver(this); | 280 activation_client_->RemoveObserver(this); |
277 } | 281 } |
278 | 282 |
279 void ShadowController::OnWindowActivated(ActivationReason reason, | 283 void ShadowController::OnWindowActivated(ActivationReason reason, |
280 aura::Window* gained_active, | 284 aura::Window* gained_active, |
281 aura::Window* lost_active) { | 285 aura::Window* lost_active) { |
282 impl_->OnWindowActivated(reason, gained_active, lost_active); | 286 impl_->OnWindowActivated(reason, gained_active, lost_active); |
283 } | 287 } |
284 | 288 |
285 } // namespace wm | 289 } // namespace wm |
OLD | NEW |