| 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 "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // when the animation sequence has completed. No more animations should be | 136 // when the animation sequence has completed. No more animations should be |
| 137 // started after EndSequence is called because the AnimationSequenceObserver | 137 // started after EndSequence is called because the AnimationSequenceObserver |
| 138 // may have destroyed itself. | 138 // may have destroyed itself. |
| 139 // NOTE: Clients of AnimationSequence should not access it after EndSequence | 139 // NOTE: Clients of AnimationSequence should not access it after EndSequence |
| 140 // has been called. | 140 // has been called. |
| 141 virtual void EndSequence(); | 141 virtual void EndSequence(); |
| 142 | 142 |
| 143 protected: | 143 protected: |
| 144 // AnimationSequence should not be instantiated directly, only through | 144 // AnimationSequence should not be instantiated directly, only through |
| 145 // subclasses. | 145 // subclasses. |
| 146 explicit AnimationSequence(base::Closure callback); | 146 explicit AnimationSequence(base::OnceClosure callback); |
| 147 | 147 |
| 148 // Subclasses should call this when the contained animations completed | 148 // Subclasses should call this when the contained animations completed |
| 149 // successfully. | 149 // successfully. |
| 150 // NOTE: This should NOT be accessed after OnAnimationCompleted has been | 150 // NOTE: This should NOT be accessed after OnAnimationCompleted has been |
| 151 // called. | 151 // called. |
| 152 virtual void OnAnimationCompleted(); | 152 virtual void OnAnimationCompleted(); |
| 153 | 153 |
| 154 // Subclasses should call this when the contained animations did NOT | 154 // Subclasses should call this when the contained animations did NOT |
| 155 // complete successfully. | 155 // complete successfully. |
| 156 // NOTE: This should NOT be accessed after OnAnimationAborted has been | 156 // NOTE: This should NOT be accessed after OnAnimationAborted has been |
| (...skipping 10 matching lines...) Expand all Loading... |
| 167 | 167 |
| 168 // Track whether the contained animations have completed or not, both | 168 // Track whether the contained animations have completed or not, both |
| 169 // successfully and unsuccessfully. | 169 // successfully and unsuccessfully. |
| 170 bool animation_completed_; | 170 bool animation_completed_; |
| 171 | 171 |
| 172 // Flag to specify whether the callback should be invoked once the sequence | 172 // Flag to specify whether the callback should be invoked once the sequence |
| 173 // has completed. | 173 // has completed. |
| 174 bool invoke_callback_; | 174 bool invoke_callback_; |
| 175 | 175 |
| 176 // Callback to be called. | 176 // Callback to be called. |
| 177 base::Closure callback_; | 177 base::OnceClosure callback_; |
| 178 | 178 |
| 179 DISALLOW_COPY_AND_ASSIGN(AnimationSequence); | 179 DISALLOW_COPY_AND_ASSIGN(AnimationSequence); |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 SessionStateAnimator(); | 182 SessionStateAnimator(); |
| 183 virtual ~SessionStateAnimator(); | 183 virtual ~SessionStateAnimator(); |
| 184 | 184 |
| 185 // Reports animation duration for |speed|. | 185 // Reports animation duration for |speed|. |
| 186 virtual base::TimeDelta GetDuration(AnimationSpeed speed); | 186 virtual base::TimeDelta GetDuration(AnimationSpeed speed); |
| 187 | 187 |
| 188 // Apply animation |type| to all containers included in |container_mask| with | 188 // Apply animation |type| to all containers included in |container_mask| with |
| 189 // specified |speed|. | 189 // specified |speed|. |
| 190 virtual void StartAnimation(int container_mask, | 190 virtual void StartAnimation(int container_mask, |
| 191 AnimationType type, | 191 AnimationType type, |
| 192 AnimationSpeed speed) = 0; | 192 AnimationSpeed speed) = 0; |
| 193 | 193 |
| 194 // Apply animation |type| to all containers included in |container_mask| with | 194 // Apply animation |type| to all containers included in |container_mask| with |
| 195 // specified |speed| and call a |callback| once at the end of the animations, | 195 // specified |speed| and call a |callback| once at the end of the animations, |
| 196 // if it is not null. | 196 // if it is not null. |
| 197 virtual void StartAnimationWithCallback(int container_mask, | 197 virtual void StartAnimationWithCallback(int container_mask, |
| 198 AnimationType type, | 198 AnimationType type, |
| 199 AnimationSpeed speed, | 199 AnimationSpeed speed, |
| 200 base::Closure callback) = 0; | 200 base::OnceClosure callback) = 0; |
| 201 | 201 |
| 202 // Begins an animation sequence. Use this when you need to be notified when | 202 // Begins an animation sequence. Use this when you need to be notified when |
| 203 // a group of animations are completed. See AnimationSequence documentation | 203 // a group of animations are completed. See AnimationSequence documentation |
| 204 // for more details. | 204 // for more details. |
| 205 virtual AnimationSequence* BeginAnimationSequence(base::Closure callback) = 0; | 205 virtual AnimationSequence* BeginAnimationSequence( |
| 206 base::OnceClosure callback) = 0; |
| 206 | 207 |
| 207 // Retruns true if the wallpaper is hidden. | 208 // Retruns true if the wallpaper is hidden. |
| 208 virtual bool IsWallpaperHidden() const = 0; | 209 virtual bool IsWallpaperHidden() const = 0; |
| 209 | 210 |
| 210 // Shows the wallpaper immediately. | 211 // Shows the wallpaper immediately. |
| 211 virtual void ShowWallpaper() = 0; | 212 virtual void ShowWallpaper() = 0; |
| 212 | 213 |
| 213 // Hides the wallpaper immediately. | 214 // Hides the wallpaper immediately. |
| 214 virtual void HideWallpaper() = 0; | 215 virtual void HideWallpaper() = 0; |
| 215 | 216 |
| 216 private: | 217 private: |
| 217 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator); | 218 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator); |
| 218 }; | 219 }; |
| 219 | 220 |
| 220 } // namespace ash | 221 } // namespace ash |
| 221 | 222 |
| 222 #endif // ASH_WM_SESSION_STATE_ANIMATOR_H_ | 223 #endif // ASH_WM_SESSION_STATE_ANIMATOR_H_ |
| OLD | NEW |