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 #ifndef ASH_WM_SESSION_STATE_ANIMATOR_H_ | 5 #ifndef ASH_WM_SESSION_STATE_ANIMATOR_H_ |
6 #define ASH_WM_SESSION_STATE_ANIMATOR_H_ | 6 #define ASH_WM_SESSION_STATE_ANIMATOR_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/wm/workspace/colored_window_controller.h" | 9 #include "ash/wm/workspace/colored_window_controller.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/timer.h" | 12 #include "base/timer.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/compositor/layer_animation_observer.h" |
14 | 15 |
15 namespace gfx { | 16 namespace gfx { |
16 class Rect; | 17 class Rect; |
17 class Size; | 18 class Size; |
18 } | 19 } |
19 | 20 |
20 namespace ui { | 21 namespace ui { |
21 class Layer; | 22 class Layer; |
22 } | 23 } |
23 | 24 |
24 namespace ash { | 25 namespace ash { |
25 namespace internal { | 26 namespace internal { |
26 | 27 |
27 // Displays onscreen animations for session state changes (lock/unlock, sign | 28 // Displays onscreen animations for session state changes (lock/unlock, sign |
28 // out, shut down). | 29 // out, shut down). |
29 class ASH_EXPORT SessionStateAnimator { | 30 class ASH_EXPORT SessionStateAnimator { |
30 public: | 31 public: |
31 // Animations that can be applied to groups of containers. | 32 // Animations that can be applied to groups of containers. |
32 enum AnimationType { | 33 enum AnimationType { |
33 ANIMATION_PARTIAL_CLOSE = 0, | 34 ANIMATION_PARTIAL_CLOSE = 0, |
34 ANIMATION_UNDO_PARTIAL_CLOSE, | 35 ANIMATION_UNDO_PARTIAL_CLOSE, |
35 ANIMATION_FULL_CLOSE, | 36 ANIMATION_FULL_CLOSE, |
36 ANIMATION_FADE_IN, | 37 ANIMATION_FADE_IN, |
| 38 ANIMATION_FADE_OUT, |
37 ANIMATION_HIDE_IMMEDIATELY, | 39 ANIMATION_HIDE_IMMEDIATELY, |
38 ANIMATION_RESTORE, | 40 ANIMATION_RESTORE, |
39 // Animations that raise/lower windows to/from area "in front" of the | 41 // Animations that raise/lower windows to/from area "in front" of the |
40 // screen. | 42 // screen. |
41 ANIMATION_LIFT, | 43 ANIMATION_LIFT, |
42 ANIMATION_DROP, | 44 ANIMATION_DROP, |
43 // Animations that raise/lower windows from/to area "behind" of the screen. | 45 // Animations that raise/lower windows from/to area "behind" of the screen. |
44 ANIMATION_RAISE_TO_SCREEN, | 46 ANIMATION_RAISE_TO_SCREEN, |
45 ANIMATION_LOWER_BELOW_SCREEN, | 47 ANIMATION_LOWER_BELOW_SCREEN, |
46 ANIMATION_PARTIAL_FADE_IN, | 48 ANIMATION_PARTIAL_FADE_IN, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // user session windows are hidden and lock UI is shown on top of it. | 92 // user session windows are hidden and lock UI is shown on top of it. |
91 // This layer is included in shutdown animation. | 93 // This layer is included in shutdown animation. |
92 LOCK_SCREEN_BACKGROUND = 1 << 3, | 94 LOCK_SCREEN_BACKGROUND = 1 << 3, |
93 | 95 |
94 // Lock screen and lock screen modal containers. | 96 // Lock screen and lock screen modal containers. |
95 LOCK_SCREEN_CONTAINERS = 1 << 4, | 97 LOCK_SCREEN_CONTAINERS = 1 << 4, |
96 | 98 |
97 // Multiple system layers belong here like status, menu, tooltip | 99 // Multiple system layers belong here like status, menu, tooltip |
98 // and overlay layers. | 100 // and overlay layers. |
99 LOCK_SCREEN_RELATED_CONTAINERS = 1 << 5, | 101 LOCK_SCREEN_RELATED_CONTAINERS = 1 << 5, |
100 | |
101 LOCK_SCREEN_SYSTEM_FOREGROUND = 1 << 6, | |
102 }; | 102 }; |
103 | 103 |
104 // Helper class used by tests to access internal state. | 104 // Helper class used by tests to access internal state. |
105 class ASH_EXPORT TestApi { | 105 class ASH_EXPORT TestApi { |
106 public: | 106 public: |
107 explicit TestApi(SessionStateAnimator* animator) | 107 explicit TestApi(SessionStateAnimator* animator) |
108 : animator_(animator) {} | 108 : animator_(animator) {} |
109 | 109 |
110 // Returns true if containers of a given |container_mask| | 110 // Returns true if containers of a given |container_mask| |
111 // were last animated with |type| (probably; the analysis is fairly ad-hoc). | 111 // were last animated with |type| (probably; the analysis is fairly ad-hoc). |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 AnimationSpeed speed); | 152 AnimationSpeed speed); |
153 | 153 |
154 // Apply animation |type| to all containers included in |container_mask| with | 154 // Apply animation |type| to all containers included in |container_mask| with |
155 // specified |speed| and call a |callback| at the end of the animation, if it | 155 // specified |speed| and call a |callback| at the end of the animation, if it |
156 // is not null. | 156 // is not null. |
157 void StartAnimationWithCallback(int container_mask, | 157 void StartAnimationWithCallback(int container_mask, |
158 AnimationType type, | 158 AnimationType type, |
159 AnimationSpeed speed, | 159 AnimationSpeed speed, |
160 base::Callback<void(void)>& callback); | 160 base::Callback<void(void)>& callback); |
161 | 161 |
| 162 // Apply animation |type| to all containers included in |container_mask| with |
| 163 // specified |speed| and add |observer| to all animations. |
| 164 void StartAnimationWithObserver(int container_mask, |
| 165 AnimationType type, |
| 166 AnimationSpeed speed, |
| 167 ui::LayerAnimationObserver* observer); |
| 168 |
162 // Applies animation |type| whith specified |speed| to the root container. | 169 // Applies animation |type| whith specified |speed| to the root container. |
163 void StartGlobalAnimation(AnimationType type, | 170 void StartGlobalAnimation(AnimationType type, |
164 AnimationSpeed speed); | 171 AnimationSpeed speed); |
165 | 172 |
166 // Apply animation |type| to window |window| with |speed| and add |observer| | 173 // Apply animation |type| to window |window| with |speed| and add |observer| |
167 // if it is not NULL to the last animation sequence. | 174 // if it is not NULL to the last animation sequence. |
168 void RunAnimationForWindow(aura::Window* window, | 175 void RunAnimationForWindow(aura::Window* window, |
169 AnimationType type, | 176 AnimationType type, |
170 AnimationSpeed speed, | 177 AnimationSpeed speed, |
171 ui::LayerAnimationObserver* observer); | 178 ui::LayerAnimationObserver* observer); |
172 | 179 |
173 // White foreground that is used during shutdown animation to "fade | 180 // White foreground that is used during shutdown animation to "fade |
174 // everything into white". | 181 // everything into white". |
175 scoped_ptr<ColoredWindowController> foreground_; | 182 scoped_ptr<ColoredWindowController> foreground_; |
176 | 183 |
177 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator); | 184 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator); |
178 }; | 185 }; |
179 | 186 |
180 } // namespace internal | 187 } // namespace internal |
181 } // namespace ash | 188 } // namespace ash |
182 | 189 |
183 #endif // ASH_WM_SESSION_STATE_ANIMATOR_H_ | 190 #endif // ASH_WM_SESSION_STATE_ANIMATOR_H_ |
OLD | NEW |