| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 UI_COMPOSITOR_SCOPED_ANIMATION_DURATION_SCALE_MODE_H_ | 5 #ifndef UI_COMPOSITOR_SCOPED_ANIMATION_DURATION_SCALE_MODE_H_ |
| 6 #define UI_COMPOSITOR_SCOPED_ANIMATION_DURATION_SCALE_MODE_H_ | 6 #define UI_COMPOSITOR_SCOPED_ANIMATION_DURATION_SCALE_MODE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "ui/compositor/compositor_export.h" | 9 #include "ui/compositor/compositor_export.h" |
| 10 | 10 |
| 11 namespace ui { | 11 namespace ui { |
| 12 | 12 |
| 13 // Speed up or slow down animations for testing or debugging. | 13 // Speed up or slow down animations for testing or debugging. |
| 14 class COMPOSITOR_EXPORT ScopedAnimationDurationScaleMode { | 14 class COMPOSITOR_EXPORT ScopedAnimationDurationScaleMode { |
| 15 public: | 15 public: |
| 16 enum DurationScaleMode { | 16 enum DurationScaleMode { |
| 17 NORMAL_DURATION, | 17 NORMAL_DURATION, |
| 18 FAST_DURATION, | 18 FAST_DURATION, |
| 19 SLOW_DURATION, | 19 SLOW_DURATION, |
| 20 // A very short but guaranteed non-zero duration for individual tests that |
| 21 // need to assert things about animations after creating them. |
| 22 TEST_DURATION, |
| 23 // Animations complete immediately after being created. Used by most unit |
| 24 // test suites. |
| 20 ZERO_DURATION | 25 ZERO_DURATION |
| 21 }; | 26 }; |
| 22 | 27 |
| 23 explicit ScopedAnimationDurationScaleMode( | 28 explicit ScopedAnimationDurationScaleMode( |
| 24 DurationScaleMode scoped_duration_scale_mode) | 29 DurationScaleMode scoped_duration_scale_mode) |
| 25 : old_duration_scale_mode_(duration_scale_mode_) { | 30 : old_duration_scale_mode_(duration_scale_mode_) { |
| 26 duration_scale_mode_ = scoped_duration_scale_mode; | 31 duration_scale_mode_ = scoped_duration_scale_mode; |
| 27 } | 32 } |
| 28 | 33 |
| 29 ~ScopedAnimationDurationScaleMode() { | 34 ~ScopedAnimationDurationScaleMode() { |
| 30 duration_scale_mode_ = old_duration_scale_mode_; | 35 duration_scale_mode_ = old_duration_scale_mode_; |
| 31 } | 36 } |
| 32 | 37 |
| 33 static DurationScaleMode duration_scale_mode() { | 38 static DurationScaleMode duration_scale_mode() { |
| 34 return duration_scale_mode_; | 39 return duration_scale_mode_; |
| 35 } | 40 } |
| 36 | 41 |
| 37 private: | 42 private: |
| 38 DurationScaleMode old_duration_scale_mode_; | 43 DurationScaleMode old_duration_scale_mode_; |
| 39 | 44 |
| 40 static DurationScaleMode duration_scale_mode_; | 45 static DurationScaleMode duration_scale_mode_; |
| 41 | 46 |
| 42 DISALLOW_COPY_AND_ASSIGN(ScopedAnimationDurationScaleMode); | 47 DISALLOW_COPY_AND_ASSIGN(ScopedAnimationDurationScaleMode); |
| 43 }; | 48 }; |
| 44 | 49 |
| 45 } // namespace ui | 50 } // namespace ui |
| 46 | 51 |
| 47 #endif // UI_COMPOSITOR_SCOPED_ANIMATION_DURATION_SCALE_MODE_H | 52 #endif // UI_COMPOSITOR_SCOPED_ANIMATION_DURATION_SCALE_MODE_H |
| OLD | NEW |