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