| 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 <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 | 170 |
| 171 void AnimateHideWindow_Minimize(aura::Window* window) { | 171 void AnimateHideWindow_Minimize(aura::Window* window) { |
| 172 window->layer()->set_delegate(NULL); | 172 window->layer()->set_delegate(NULL); |
| 173 | 173 |
| 174 // Property sets within this scope will be implicitly animated. | 174 // Property sets within this scope will be implicitly animated. |
| 175 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); | 175 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
| 176 base::TimeDelta duration = base::TimeDelta::FromMilliseconds( | 176 base::TimeDelta duration = base::TimeDelta::FromMilliseconds( |
| 177 kLayerAnimationsForMinimizeDurationMS); | 177 kLayerAnimationsForMinimizeDurationMS); |
| 178 settings.SetTransitionDuration(duration); | 178 settings.SetTransitionDuration(duration); |
| 179 settings.AddObserver( | 179 scoped_ptr<views::corewm::LayerDetacherForHidingAnimation> detacher = |
| 180 views::corewm::CreateHidingWindowAnimationObserver(window)); | 180 views::corewm::DetachAndRecreateLayersForHidingAnimation( |
| 181 window, &settings).Pass(); |
| 181 window->layer()->SetVisible(false); | 182 window->layer()->SetVisible(false); |
| 182 | 183 |
| 183 AddLayerAnimationsForMinimize(window, false); | 184 AddLayerAnimationsForMinimize(window, false); |
| 184 } | 185 } |
| 185 | 186 |
| 186 void AnimateShowHideWindowCommon_BrightnessGrayscale(aura::Window* window, | 187 void AnimateShowHideWindowCommon_BrightnessGrayscale(aura::Window* window, |
| 187 bool show) { | 188 bool show) { |
| 188 window->layer()->set_delegate(window); | 189 window->layer()->set_delegate(window); |
| 189 | 190 |
| 190 float start_value, end_value; | 191 float start_value, end_value; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 202 window->layer()->SetOpacity(kWindowAnimation_ShowOpacity); | 203 window->layer()->SetOpacity(kWindowAnimation_ShowOpacity); |
| 203 window->layer()->SetVisible(true); | 204 window->layer()->SetVisible(true); |
| 204 } | 205 } |
| 205 | 206 |
| 206 base::TimeDelta duration = | 207 base::TimeDelta duration = |
| 207 base::TimeDelta::FromMilliseconds(kBrightnessGrayscaleFadeDurationMs); | 208 base::TimeDelta::FromMilliseconds(kBrightnessGrayscaleFadeDurationMs); |
| 208 | 209 |
| 209 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); | 210 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
| 210 settings.SetTransitionDuration(duration); | 211 settings.SetTransitionDuration(duration); |
| 211 if (!show) { | 212 if (!show) { |
| 212 settings.AddObserver( | 213 views::corewm::DetachLayersForHidingAnimationWhenDestroyed( |
| 213 views::corewm::CreateHidingWindowAnimationObserver(window)); | 214 window, &settings); |
| 214 } | 215 } |
| 215 | 216 |
| 216 window->layer()->GetAnimator()-> | 217 window->layer()->GetAnimator()-> |
| 217 ScheduleTogether( | 218 ScheduleTogether( |
| 218 CreateBrightnessGrayscaleAnimationSequence(end_value, duration)); | 219 CreateBrightnessGrayscaleAnimationSequence(end_value, duration)); |
| 219 if (!show) { | 220 if (!show) { |
| 220 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); | 221 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); |
| 221 window->layer()->SetVisible(false); | 222 window->layer()->SetVisible(false); |
| 222 } | 223 } |
| 223 } | 224 } |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 } | 496 } |
| 496 | 497 |
| 497 // Assume the shelf is overflowed, zoom off to the bottom right of the | 498 // Assume the shelf is overflowed, zoom off to the bottom right of the |
| 498 // work area. | 499 // work area. |
| 499 gfx::Rect work_area = | 500 gfx::Rect work_area = |
| 500 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); | 501 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
| 501 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0); | 502 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0); |
| 502 } | 503 } |
| 503 | 504 |
| 504 } // namespace ash | 505 } // namespace ash |
| OLD | NEW |