Chromium Code Reviews| 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, |
| 44 ANIMATION_UNDO_LIFT, | |
| 42 ANIMATION_DROP, | 45 ANIMATION_DROP, |
| 43 // Animations that raise/lower windows from/to area "behind" of the screen. | 46 // Animations that raise/lower windows from/to area "behind" of the screen. |
| 44 ANIMATION_RAISE_TO_SCREEN, | 47 ANIMATION_RAISE_TO_SCREEN, |
| 45 ANIMATION_LOWER_BELOW_SCREEN, | 48 ANIMATION_LOWER_BELOW_SCREEN, |
| 46 ANIMATION_PARTIAL_FADE_IN, | 49 ANIMATION_PARTIAL_FADE_IN, |
| 47 ANIMATION_UNDO_PARTIAL_FADE_IN, | 50 ANIMATION_UNDO_PARTIAL_FADE_IN, |
| 48 ANIMATION_FULL_FADE_IN, | 51 ANIMATION_FULL_FADE_IN, |
| 49 ANIMATION_GRAYSCALE_BRIGHTNESS, | 52 ANIMATION_GRAYSCALE_BRIGHTNESS, |
| 50 ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS, | 53 ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS, |
| 51 }; | 54 }; |
| (...skipping 38 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. | 93 // user session windows are hidden and lock UI is shown on top of it. |
| 91 // This layer is included in shutdown animation. | 94 // This layer is included in shutdown animation. |
| 92 LOCK_SCREEN_BACKGROUND = 1 << 3, | 95 LOCK_SCREEN_BACKGROUND = 1 << 3, |
| 93 | 96 |
| 94 // Lock screen and lock screen modal containers. | 97 // Lock screen and lock screen modal containers. |
| 95 LOCK_SCREEN_CONTAINERS = 1 << 4, | 98 LOCK_SCREEN_CONTAINERS = 1 << 4, |
| 96 | 99 |
| 97 // Multiple system layers belong here like status, menu, tooltip | 100 // Multiple system layers belong here like status, menu, tooltip |
| 98 // and overlay layers. | 101 // and overlay layers. |
| 99 LOCK_SCREEN_RELATED_CONTAINERS = 1 << 5, | 102 LOCK_SCREEN_RELATED_CONTAINERS = 1 << 5, |
| 100 | |
| 101 LOCK_SCREEN_SYSTEM_FOREGROUND = 1 << 6, | |
| 102 }; | 103 }; |
| 103 | 104 |
| 104 // Helper class used by tests to access internal state. | 105 // Helper class used by tests to access internal state. |
| 105 class ASH_EXPORT TestApi { | 106 class ASH_EXPORT TestApi { |
| 106 public: | 107 public: |
| 107 explicit TestApi(SessionStateAnimator* animator) | 108 explicit TestApi(SessionStateAnimator* animator) |
| 108 : animator_(animator) {} | 109 : animator_(animator) {} |
| 109 | 110 |
| 110 // Returns true if containers of a given |container_mask| | 111 // Returns true if containers of a given |container_mask| |
| 111 // were last animated with |type| (probably; the analysis is fairly ad-hoc). | 112 // 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); | 153 AnimationSpeed speed); |
| 153 | 154 |
| 154 // Apply animation |type| to all containers included in |container_mask| with | 155 // 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 | 156 // specified |speed| and call a |callback| at the end of the animation, if it |
| 156 // is not null. | 157 // is not null. |
| 157 void StartAnimationWithCallback(int container_mask, | 158 void StartAnimationWithCallback(int container_mask, |
| 158 AnimationType type, | 159 AnimationType type, |
| 159 AnimationSpeed speed, | 160 AnimationSpeed speed, |
| 160 base::Callback<void(void)>& callback); | 161 base::Callback<void(void)>& callback); |
| 161 | 162 |
| 163 // Apply animation |type| to all containers included in |container_mask| with | |
|
Daniel Erat
2012/12/13 21:47:33
nit: indent this comment two more spaces
| |
| 164 // specified |speed| and add |observer| to all animations. | |
| 165 void StartAnimationWithObserver(int container_mask, | |
| 166 AnimationType type, | |
| 167 AnimationSpeed speed, | |
| 168 ui::LayerAnimationObserver* observer); | |
| 169 | |
| 162 // Applies animation |type| whith specified |speed| to the root container. | 170 // Applies animation |type| whith specified |speed| to the root container. |
| 163 void StartGlobalAnimation(AnimationType type, | 171 void StartGlobalAnimation(AnimationType type, |
| 164 AnimationSpeed speed); | 172 AnimationSpeed speed); |
| 165 | 173 |
| 166 // Apply animation |type| to window |window| with |speed| and add |observer| | 174 // Apply animation |type| to window |window| with |speed| and add |observer| |
| 167 // if it is not NULL to the last animation sequence. | 175 // if it is not NULL to the last animation sequence. |
| 168 void RunAnimationForWindow(aura::Window* window, | 176 void RunAnimationForWindow(aura::Window* window, |
| 169 AnimationType type, | 177 AnimationType type, |
| 170 AnimationSpeed speed, | 178 AnimationSpeed speed, |
| 171 ui::LayerAnimationObserver* observer); | 179 ui::LayerAnimationObserver* observer); |
| 172 | 180 |
| 173 // White foreground that is used during shutdown animation to "fade | 181 // White foreground that is used during shutdown animation to "fade |
| 174 // everything into white". | 182 // everything into white". |
| 175 scoped_ptr<ColoredWindowController> foreground_; | 183 scoped_ptr<ColoredWindowController> foreground_; |
| 176 | 184 |
| 177 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator); | 185 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator); |
| 178 }; | 186 }; |
| 179 | 187 |
| 180 } // namespace internal | 188 } // namespace internal |
| 181 } // namespace ash | 189 } // namespace ash |
| 182 | 190 |
| 183 #endif // ASH_WM_SESSION_STATE_ANIMATOR_H_ | 191 #endif // ASH_WM_SESSION_STATE_ANIMATOR_H_ |
| OLD | NEW |