Chromium Code Reviews| 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_aura.h" | 5 #include "ash/wm/overview/scoped_overview_animation_settings_aura.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 9 #include "ui/compositor/layer.h" | 9 #include "ui/compositor/layer.h" |
| 10 #include "ui/gfx/animation/tween.h" | 10 #include "ui/gfx/animation/tween.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // The time duration for transformation animations. | 16 // The time duration for transformation animations. |
| 17 const int kTransitionMilliseconds = 200; | 17 const int kTransitionMilliseconds = 200; |
| 18 | 18 |
| 19 // The time duration for layout update. Only different with Material Design; | |
|
tdanderson
2016/06/28 15:28:02
nit: ;
Also reading this I find "only different w
varkha
2016/06/28 23:50:37
Done.
| |
| 20 const int kCloseTransitionMillisecondsMD = 200; | |
|
tdanderson
2016/06/28 15:28:02
nit: it was suggested to me in a separate CL to us
varkha
2016/06/28 23:50:37
Done.
| |
| 21 | |
| 19 // The time duration for widgets to fade in. | 22 // The time duration for widgets to fade in. |
| 20 const int kFadeInMilliseconds = 80; | 23 const int kFadeInMilliseconds = 80; |
| 21 | 24 |
| 22 base::TimeDelta GetAnimationDuration(OverviewAnimationType animation_type) { | 25 base::TimeDelta GetAnimationDuration(OverviewAnimationType animation_type) { |
| 23 switch (animation_type) { | 26 switch (animation_type) { |
| 24 case OVERVIEW_ANIMATION_NONE: | 27 case OVERVIEW_ANIMATION_NONE: |
| 25 return base::TimeDelta(); | 28 return base::TimeDelta(); |
| 26 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN: | 29 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN: |
| 27 return base::TimeDelta::FromMilliseconds(kFadeInMilliseconds); | 30 return base::TimeDelta::FromMilliseconds(kFadeInMilliseconds); |
| 28 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: | 31 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: |
| 29 case OVERVIEW_ANIMATION_RESTORE_WINDOW: | 32 case OVERVIEW_ANIMATION_RESTORE_WINDOW: |
| 30 case OVERVIEW_ANIMATION_HIDE_WINDOW: | 33 case OVERVIEW_ANIMATION_HIDE_WINDOW: |
| 31 return base::TimeDelta::FromMilliseconds(kTransitionMilliseconds); | 34 return base::TimeDelta::FromMilliseconds(kTransitionMilliseconds); |
| 35 case OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM: | |
| 36 return base::TimeDelta::FromMilliseconds(kCloseTransitionMillisecondsMD); | |
| 32 } | 37 } |
| 33 NOTREACHED(); | 38 NOTREACHED(); |
| 34 return base::TimeDelta(); | 39 return base::TimeDelta(); |
| 35 } | 40 } |
| 36 | 41 |
| 37 } // namespace | 42 } // namespace |
| 38 | 43 |
| 39 ScopedOverviewAnimationSettingsAura::ScopedOverviewAnimationSettingsAura( | 44 ScopedOverviewAnimationSettingsAura::ScopedOverviewAnimationSettingsAura( |
| 40 OverviewAnimationType animation_type, | 45 OverviewAnimationType animation_type, |
| 41 aura::Window* window) | 46 aura::Window* window) |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 52 ui::LayerAnimationElement::OPACITY); | 57 ui::LayerAnimationElement::OPACITY); |
| 53 animation_settings_.SetPreemptionStrategy( | 58 animation_settings_.SetPreemptionStrategy( |
| 54 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 59 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
| 55 break; | 60 break; |
| 56 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: | 61 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: |
| 57 case OVERVIEW_ANIMATION_RESTORE_WINDOW: | 62 case OVERVIEW_ANIMATION_RESTORE_WINDOW: |
| 58 animation_settings_.SetPreemptionStrategy( | 63 animation_settings_.SetPreemptionStrategy( |
| 59 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 64 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 60 animation_settings_.SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); | 65 animation_settings_.SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); |
| 61 break; | 66 break; |
| 67 case OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM: | |
| 68 animation_settings_.SetPreemptionStrategy( | |
| 69 ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); | |
| 70 animation_settings_.SetTweenType(gfx::Tween::EASE_OUT); | |
| 71 break; | |
| 62 case OVERVIEW_ANIMATION_HIDE_WINDOW: | 72 case OVERVIEW_ANIMATION_HIDE_WINDOW: |
| 63 animation_settings_.SetPreemptionStrategy( | 73 animation_settings_.SetPreemptionStrategy( |
| 64 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 74 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 65 break; | 75 break; |
| 66 } | 76 } |
| 67 animation_settings_.SetTransitionDuration( | 77 animation_settings_.SetTransitionDuration( |
| 68 GetAnimationDuration(animation_type)); | 78 GetAnimationDuration(animation_type)); |
| 69 } | 79 } |
| 70 | 80 |
| 71 ScopedOverviewAnimationSettingsAura::~ScopedOverviewAnimationSettingsAura() {} | 81 ScopedOverviewAnimationSettingsAura::~ScopedOverviewAnimationSettingsAura() {} |
| 72 | 82 |
| 73 } // namespace ash | 83 } // namespace ash |
| OLD | NEW |