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 "ash/wm/window_animations.h" | 5 #include "ash/wm/window_animations.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 164 } |
165 | 165 |
166 // Hides a window using an animation, animating its opacity from 1.f to 0.f, and | 166 // Hides a window using an animation, animating its opacity from 1.f to 0.f, and |
167 // its transform to |end_transform|. | 167 // its transform to |end_transform|. |
168 void AnimateHideWindowCommon(aura::Window* window, | 168 void AnimateHideWindowCommon(aura::Window* window, |
169 const ui::Transform& end_transform) { | 169 const ui::Transform& end_transform) { |
170 window->layer()->set_delegate(NULL); | 170 window->layer()->set_delegate(NULL); |
171 | 171 |
172 // Property sets within this scope will be implicitly animated. | 172 // Property sets within this scope will be implicitly animated. |
173 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); | 173 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
174 settings.AddImplicitObserver(new HidingWindowAnimationObserver(window)); | 174 settings.AddObserver(new HidingWindowAnimationObserver(window)); |
| 175 |
175 int duration = | 176 int duration = |
176 window->GetIntProperty(internal::kWindowVisibilityAnimationDurationKey); | 177 window->GetIntProperty(internal::kWindowVisibilityAnimationDurationKey); |
177 if (duration > 0) { | 178 if (duration > 0) { |
178 settings.SetTransitionDuration( | 179 settings.SetTransitionDuration( |
179 base::TimeDelta::FromInternalValue(duration)); | 180 base::TimeDelta::FromInternalValue(duration)); |
180 } | 181 } |
181 | 182 |
182 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); | 183 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); |
183 window->layer()->SetTransform(end_transform); | 184 window->layer()->SetTransform(end_transform); |
184 } | 185 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 return AnimateShowWindow(window); | 279 return AnimateShowWindow(window); |
279 } else { | 280 } else { |
280 // Don't start hiding the window again if it's already being hidden. | 281 // Don't start hiding the window again if it's already being hidden. |
281 return window->layer()->GetTargetOpacity() != 0.0f && | 282 return window->layer()->GetTargetOpacity() != 0.0f && |
282 AnimateHideWindow(window); | 283 AnimateHideWindow(window); |
283 } | 284 } |
284 } | 285 } |
285 | 286 |
286 } // namespace internal | 287 } // namespace internal |
287 } // namespace ash | 288 } // namespace ash |
OLD | NEW |