Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: ash/wm/overview/scoped_overview_animation_settings.cc

Issue 965813003: Removed the "Swipe to close in overview" feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/overview/overview_animation_type.h ('k') | ash/wm/overview/window_selector_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h"
6 6
7 #include "ash/wm/overview/overview_animation_type.h" 7 #include "ash/wm/overview/overview_animation_type.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/compositor/layer.h" 10 #include "ui/compositor/layer.h"
11 #include "ui/gfx/animation/tween.h" 11 #include "ui/gfx/animation/tween.h"
12 12
13 namespace ash { 13 namespace ash {
14 14
15 namespace { 15 namespace {
16 16
17 // The time duration for transformation animations. 17 // The time duration for transformation animations.
18 const int kTransitionMilliseconds = 200; 18 const int kTransitionMilliseconds = 200;
19 19
20 // The time duration for widgets to fade in. 20 // The time duration for widgets to fade in.
21 const int kFadeInMilliseconds = 80; 21 const int kFadeInMilliseconds = 80;
22 22
23 // The time duration for widgets to fade out.
24 const int kFadeOutMilliseconds = 100;
25
26 base::TimeDelta GetAnimationDuration(OverviewAnimationType animation_type) { 23 base::TimeDelta GetAnimationDuration(OverviewAnimationType animation_type) {
27 switch (animation_type) { 24 switch (animation_type) {
28 case OVERVIEW_ANIMATION_NONE: 25 case OVERVIEW_ANIMATION_NONE:
29 case OVERVIEW_ANIMATION_SCROLL_SELECTOR_ITEM:
30 return base::TimeDelta(); 26 return base::TimeDelta();
31 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN: 27 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN:
32 return base::TimeDelta::FromMilliseconds(kFadeInMilliseconds); 28 return base::TimeDelta::FromMilliseconds(kFadeInMilliseconds);
33 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_OUT:
34 return base::TimeDelta::FromMilliseconds(kFadeOutMilliseconds);
35 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: 29 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS:
36 case OVERVIEW_ANIMATION_RESTORE_WINDOW: 30 case OVERVIEW_ANIMATION_RESTORE_WINDOW:
37 case OVERVIEW_ANIMATION_HIDE_WINDOW: 31 case OVERVIEW_ANIMATION_HIDE_WINDOW:
38 case OVERVIEW_ANIMATION_CANCEL_SELECTOR_ITEM_SCROLL:
39 return base::TimeDelta::FromMilliseconds(kTransitionMilliseconds); 32 return base::TimeDelta::FromMilliseconds(kTransitionMilliseconds);
40 } 33 }
41 NOTREACHED(); 34 NOTREACHED();
42 return base::TimeDelta(); 35 return base::TimeDelta();
43 } 36 }
44 37
45 } // namespace 38 } // namespace
46 39
47 ScopedOverviewAnimationSettings::ScopedOverviewAnimationSettings( 40 ScopedOverviewAnimationSettings::ScopedOverviewAnimationSettings(
48 OverviewAnimationType animation_type, 41 OverviewAnimationType animation_type,
49 aura::Window* window) 42 aura::Window* window)
50 : animation_settings_(window->layer()->GetAnimator()) { 43 : animation_settings_(window->layer()->GetAnimator()) {
51 44
52 switch (animation_type) { 45 switch (animation_type) {
53 case OVERVIEW_ANIMATION_NONE: 46 case OVERVIEW_ANIMATION_NONE:
54 case OVERVIEW_ANIMATION_SCROLL_SELECTOR_ITEM:
55 animation_settings_.SetPreemptionStrategy( 47 animation_settings_.SetPreemptionStrategy(
56 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 48 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
57 break; 49 break;
58 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN: 50 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN:
59 window->layer()->GetAnimator()->SchedulePauseForProperties( 51 window->layer()->GetAnimator()->SchedulePauseForProperties(
60 GetAnimationDuration( 52 GetAnimationDuration(
61 OverviewAnimationType::OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS), 53 OverviewAnimationType::OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS),
62 ui::LayerAnimationElement::OPACITY); 54 ui::LayerAnimationElement::OPACITY);
63 animation_settings_.SetPreemptionStrategy( 55 animation_settings_.SetPreemptionStrategy(
64 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 56 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
65 break; 57 break;
66 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_OUT:
67 animation_settings_.SetPreemptionStrategy(
68 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
69 break;
70 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: 58 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS:
71 case OVERVIEW_ANIMATION_RESTORE_WINDOW: 59 case OVERVIEW_ANIMATION_RESTORE_WINDOW:
72 animation_settings_.SetPreemptionStrategy( 60 animation_settings_.SetPreemptionStrategy(
73 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 61 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
74 animation_settings_.SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); 62 animation_settings_.SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN);
75 break; 63 break;
76 case OVERVIEW_ANIMATION_HIDE_WINDOW: 64 case OVERVIEW_ANIMATION_HIDE_WINDOW:
77 animation_settings_.SetPreemptionStrategy( 65 animation_settings_.SetPreemptionStrategy(
78 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 66 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
79 break; 67 break;
80 case OVERVIEW_ANIMATION_CANCEL_SELECTOR_ITEM_SCROLL:
81 animation_settings_.SetPreemptionStrategy(
82 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
83 animation_settings_.SetTweenType(gfx::Tween::EASE_IN_OUT);
84 break;
85 } 68 }
86 animation_settings_.SetTransitionDuration( 69 animation_settings_.SetTransitionDuration(
87 GetAnimationDuration(animation_type)); 70 GetAnimationDuration(animation_type));
88 } 71 }
89 72
90 ScopedOverviewAnimationSettings::~ScopedOverviewAnimationSettings() { 73 ScopedOverviewAnimationSettings::~ScopedOverviewAnimationSettings() {
91 } 74 }
92 75
93 } // namespace ash 76 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/overview_animation_type.h ('k') | ash/wm/overview/window_selector_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698