Index: chrome/browser/ui/cocoa/animation_utils.h |
diff --git a/chrome/browser/ui/cocoa/animation_utils.h b/chrome/browser/ui/cocoa/animation_utils.h |
index 3a34e0eb8a8d09f4d3da9fb996c7055382a6696d..5ed7ffa09fa895e20e1d10d239bf8406c405bf15 100644 |
--- a/chrome/browser/ui/cocoa/animation_utils.h |
+++ b/chrome/browser/ui/cocoa/animation_utils.h |
@@ -31,5 +31,32 @@ class WithNoAnimation { |
} |
}; |
+// Disables actions within a scope. |
+class ScopedCAActionDisabler { |
+ public: |
+ ScopedCAActionDisabler() { |
+ [CATransaction begin]; |
+ [CATransaction setValue:[NSNumber numberWithBool:YES] |
+ forKey:kCATransactionDisableActions]; |
+ } |
+ |
+ ~ScopedCAActionDisabler() { |
+ [CATransaction commit]; |
+ } |
+}; |
+ |
+// Sets a duration on actions within a scope. |
+class ScopedCAActionSetDuration { |
+ public: |
+ explicit ScopedCAActionSetDuration(NSTimeInterval duration) { |
+ [CATransaction begin]; |
+ [CATransaction setValue:[NSNumber numberWithFloat:duration] |
+ forKey:kCATransactionAnimationDuration]; |
+ } |
+ |
+ ~ScopedCAActionSetDuration() { |
+ [CATransaction commit]; |
+ } |
+}; |
#endif // CHROME_BROWSER_UI_COCOA_ANIMATION_UTILS_H |