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/session_state_animator.h" | 5 #include "ash/wm/session_state_animator.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
8 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
9 #include "ash/shell.h" | 11 #include "ash/shell.h" |
10 #include "ash/wm/window_animations.h" | 12 #include "ash/wm/window_animations.h" |
11 #include "base/command_line.h" | 13 #include "base/command_line.h" |
12 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
13 #include "ui/aura/window_event_dispatcher.h" | 15 #include "ui/aura/window_event_dispatcher.h" |
14 #include "ui/compositor/layer_animation_observer.h" | 16 #include "ui/compositor/layer_animation_observer.h" |
15 #include "ui/compositor/layer_animation_sequence.h" | 17 #include "ui/compositor/layer_animation_sequence.h" |
16 #include "ui/compositor/scoped_layer_animation_settings.h" | 18 #include "ui/compositor/scoped_layer_animation_settings.h" |
(...skipping 14 matching lines...) Expand all Loading... |
31 SessionStateAnimator::LOCK_SCREEN_WALLPAPER | | 33 SessionStateAnimator::LOCK_SCREEN_WALLPAPER | |
32 SessionStateAnimator::LOCK_SCREEN_CONTAINERS | | 34 SessionStateAnimator::LOCK_SCREEN_CONTAINERS | |
33 SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS; | 35 SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS; |
34 | 36 |
35 const int SessionStateAnimator::kAllNonRootContainersMask = | 37 const int SessionStateAnimator::kAllNonRootContainersMask = |
36 SessionStateAnimator::kAllLockScreenContainersMask | | 38 SessionStateAnimator::kAllLockScreenContainersMask | |
37 SessionStateAnimator::WALLPAPER | SessionStateAnimator::LAUNCHER | | 39 SessionStateAnimator::WALLPAPER | SessionStateAnimator::LAUNCHER | |
38 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS; | 40 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS; |
39 | 41 |
40 SessionStateAnimator::AnimationSequence::AnimationSequence( | 42 SessionStateAnimator::AnimationSequence::AnimationSequence( |
41 base::Closure callback) | 43 base::OnceClosure callback) |
42 : sequence_ended_(false), | 44 : sequence_ended_(false), |
43 animation_completed_(false), | 45 animation_completed_(false), |
44 invoke_callback_(false), | 46 invoke_callback_(false), |
45 callback_(callback) {} | 47 callback_(std::move(callback)) {} |
46 | 48 |
47 SessionStateAnimator::AnimationSequence::~AnimationSequence() {} | 49 SessionStateAnimator::AnimationSequence::~AnimationSequence() {} |
48 | 50 |
49 void SessionStateAnimator::AnimationSequence::EndSequence() { | 51 void SessionStateAnimator::AnimationSequence::EndSequence() { |
50 sequence_ended_ = true; | 52 sequence_ended_ = true; |
51 CleanupIfSequenceCompleted(); | 53 CleanupIfSequenceCompleted(); |
52 } | 54 } |
53 | 55 |
54 void SessionStateAnimator::AnimationSequence::OnAnimationCompleted() { | 56 void SessionStateAnimator::AnimationSequence::OnAnimationCompleted() { |
55 animation_completed_ = true; | 57 animation_completed_ = true; |
56 invoke_callback_ = true; | 58 invoke_callback_ = true; |
57 CleanupIfSequenceCompleted(); | 59 CleanupIfSequenceCompleted(); |
58 } | 60 } |
59 | 61 |
60 void SessionStateAnimator::AnimationSequence::OnAnimationAborted() { | 62 void SessionStateAnimator::AnimationSequence::OnAnimationAborted() { |
61 animation_completed_ = true; | 63 animation_completed_ = true; |
62 invoke_callback_ = false; | 64 invoke_callback_ = false; |
63 CleanupIfSequenceCompleted(); | 65 CleanupIfSequenceCompleted(); |
64 } | 66 } |
65 | 67 |
66 void SessionStateAnimator::AnimationSequence::CleanupIfSequenceCompleted() { | 68 void SessionStateAnimator::AnimationSequence::CleanupIfSequenceCompleted() { |
67 if (sequence_ended_ && animation_completed_) { | 69 if (sequence_ended_ && animation_completed_) { |
68 if (invoke_callback_) | 70 if (invoke_callback_) |
69 callback_.Run(); | 71 std::move(callback_).Run(); |
70 delete this; | 72 delete this; |
71 } | 73 } |
72 } | 74 } |
73 | 75 |
74 SessionStateAnimator::SessionStateAnimator() {} | 76 SessionStateAnimator::SessionStateAnimator() {} |
75 | 77 |
76 SessionStateAnimator::~SessionStateAnimator() {} | 78 SessionStateAnimator::~SessionStateAnimator() {} |
77 | 79 |
78 base::TimeDelta SessionStateAnimator::GetDuration( | 80 base::TimeDelta SessionStateAnimator::GetDuration( |
79 SessionStateAnimator::AnimationSpeed speed) { | 81 SessionStateAnimator::AnimationSpeed speed) { |
(...skipping 18 matching lines...) Expand all Loading... |
98 case ANIMATION_SPEED_REVERT_SHUTDOWN: | 100 case ANIMATION_SPEED_REVERT_SHUTDOWN: |
99 return base::TimeDelta::FromMilliseconds(500); | 101 return base::TimeDelta::FromMilliseconds(500); |
100 } | 102 } |
101 // Satisfy compilers that do not understand that we will return from switch | 103 // Satisfy compilers that do not understand that we will return from switch |
102 // above anyway. | 104 // above anyway. |
103 DCHECK(false) << "Unhandled animation speed " << speed; | 105 DCHECK(false) << "Unhandled animation speed " << speed; |
104 return base::TimeDelta(); | 106 return base::TimeDelta(); |
105 } | 107 } |
106 | 108 |
107 } // namespace ash | 109 } // namespace ash |
OLD | NEW |