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.AddObserver(new HidingWindowAnimationObserver(window)); | 174 settings.AddImplicitObserver(new HidingWindowAnimationObserver(window)); |
175 | |
176 int duration = | 175 int duration = |
177 window->GetIntProperty(internal::kWindowVisibilityAnimationDurationKey); | 176 window->GetIntProperty(internal::kWindowVisibilityAnimationDurationKey); |
178 if (duration > 0) { | 177 if (duration > 0) { |
179 settings.SetTransitionDuration( | 178 settings.SetTransitionDuration( |
180 base::TimeDelta::FromInternalValue(duration)); | 179 base::TimeDelta::FromInternalValue(duration)); |
181 } | 180 } |
182 | 181 |
183 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); | 182 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); |
184 window->layer()->SetTransform(end_transform); | 183 window->layer()->SetTransform(end_transform); |
185 } | 184 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 return AnimateShowWindow(window); | 278 return AnimateShowWindow(window); |
280 } else { | 279 } else { |
281 // Don't start hiding the window again if it's already being hidden. | 280 // Don't start hiding the window again if it's already being hidden. |
282 return window->layer()->GetTargetOpacity() != 0.0f && | 281 return window->layer()->GetTargetOpacity() != 0.0f && |
283 AnimateHideWindow(window); | 282 AnimateHideWindow(window); |
284 } | 283 } |
285 } | 284 } |
286 | 285 |
287 } // namespace internal | 286 } // namespace internal |
288 } // namespace ash | 287 } // namespace ash |
OLD | NEW |