| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/overview/scoped_overview_animation_settings.h" | 5 #include "ash/wm/overview/scoped_overview_animation_settings_aura.h" |
| 6 | 6 |
| 7 #include "ash/wm/overview/overview_animation_type.h" | |
| 8 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 9 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 10 #include "ui/compositor/layer.h" | 9 #include "ui/compositor/layer.h" |
| 11 #include "ui/gfx/animation/tween.h" | 10 #include "ui/gfx/animation/tween.h" |
| 12 | 11 |
| 13 namespace ash { | 12 namespace ash { |
| 14 | 13 |
| 15 namespace { | 14 namespace { |
| 16 | 15 |
| 17 // The time duration for transformation animations. | 16 // The time duration for transformation animations. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 30 case OVERVIEW_ANIMATION_RESTORE_WINDOW: | 29 case OVERVIEW_ANIMATION_RESTORE_WINDOW: |
| 31 case OVERVIEW_ANIMATION_HIDE_WINDOW: | 30 case OVERVIEW_ANIMATION_HIDE_WINDOW: |
| 32 return base::TimeDelta::FromMilliseconds(kTransitionMilliseconds); | 31 return base::TimeDelta::FromMilliseconds(kTransitionMilliseconds); |
| 33 } | 32 } |
| 34 NOTREACHED(); | 33 NOTREACHED(); |
| 35 return base::TimeDelta(); | 34 return base::TimeDelta(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 } // namespace | 37 } // namespace |
| 39 | 38 |
| 40 ScopedOverviewAnimationSettings::ScopedOverviewAnimationSettings( | 39 ScopedOverviewAnimationSettingsAura::ScopedOverviewAnimationSettingsAura( |
| 41 OverviewAnimationType animation_type, | 40 OverviewAnimationType animation_type, |
| 42 aura::Window* window) | 41 aura::Window* window) |
| 43 : animation_settings_(window->layer()->GetAnimator()) { | 42 : animation_settings_(window->layer()->GetAnimator()) { |
| 44 | |
| 45 switch (animation_type) { | 43 switch (animation_type) { |
| 46 case OVERVIEW_ANIMATION_NONE: | 44 case OVERVIEW_ANIMATION_NONE: |
| 47 animation_settings_.SetPreemptionStrategy( | 45 animation_settings_.SetPreemptionStrategy( |
| 48 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 46 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
| 49 break; | 47 break; |
| 50 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN: | 48 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN: |
| 51 window->layer()->GetAnimator()->SchedulePauseForProperties( | 49 window->layer()->GetAnimator()->SchedulePauseForProperties( |
| 52 GetAnimationDuration( | 50 GetAnimationDuration( |
| 53 OverviewAnimationType::OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS), | 51 OverviewAnimationType::OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS), |
| 54 ui::LayerAnimationElement::OPACITY); | 52 ui::LayerAnimationElement::OPACITY); |
| 55 animation_settings_.SetPreemptionStrategy( | 53 animation_settings_.SetPreemptionStrategy( |
| 56 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 54 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
| 57 break; | 55 break; |
| 58 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: | 56 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: |
| 59 case OVERVIEW_ANIMATION_RESTORE_WINDOW: | 57 case OVERVIEW_ANIMATION_RESTORE_WINDOW: |
| 60 animation_settings_.SetPreemptionStrategy( | 58 animation_settings_.SetPreemptionStrategy( |
| 61 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 59 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 62 animation_settings_.SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); | 60 animation_settings_.SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); |
| 63 break; | 61 break; |
| 64 case OVERVIEW_ANIMATION_HIDE_WINDOW: | 62 case OVERVIEW_ANIMATION_HIDE_WINDOW: |
| 65 animation_settings_.SetPreemptionStrategy( | 63 animation_settings_.SetPreemptionStrategy( |
| 66 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 64 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 67 break; | 65 break; |
| 68 } | 66 } |
| 69 animation_settings_.SetTransitionDuration( | 67 animation_settings_.SetTransitionDuration( |
| 70 GetAnimationDuration(animation_type)); | 68 GetAnimationDuration(animation_type)); |
| 71 } | 69 } |
| 72 | 70 |
| 73 ScopedOverviewAnimationSettings::~ScopedOverviewAnimationSettings() { | 71 ScopedOverviewAnimationSettingsAura::~ScopedOverviewAnimationSettingsAura() {} |
| 74 } | |
| 75 | 72 |
| 76 } // namespace ash | 73 } // namespace ash |
| OLD | NEW |