Chromium Code Reviews| Index: base/mac/scoped_smooth_scrolling_disabler_mac.mm |
| diff --git a/base/mac/scoped_smooth_scrolling_disabler_mac.mm b/base/mac/scoped_smooth_scrolling_disabler_mac.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..57c1e723d88f7a6a4b7a01ef3fc43fcdc4208ad2 |
| --- /dev/null |
| +++ b/base/mac/scoped_smooth_scrolling_disabler_mac.mm |
| @@ -0,0 +1,26 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/mac/scoped_smooth_scrolling_disabler_mac.h" |
| + |
| +#include <Cocoa/Cocoa.h> |
| + |
| +namespace base { |
| + |
| +ScopedSmoothScrollingDisabler::ScopedSmoothScrollingDisabler( |
| + bool actually_disable) { |
| + if (actually_disable) { |
| + // With smooth scrolling, cmd-down et al send many small scroll events on a |
| + // timer, which is problematic for some tests. |
| + [[NSUserDefaults standardUserDefaults] |
| + setBool:NO forKey:@"AppleScrollAnimationEnabled"]; |
|
Mark Mentovai
2011/08/31 02:59:57
These suck because they leave bad prefs on the dis
Nico
2011/08/31 03:30:51
I couldn't think of one; this is how Apple's DRT d
Mark Mentovai
2011/08/31 03:39:01
My concern is actually the confluence of (a) and (
|
| + } |
| +} |
| + |
| +ScopedSmoothScrollingDisabler::~ScopedSmoothScrollingDisabler() { |
| + [[NSUserDefaults standardUserDefaults] |
| + removeObjectForKey:@"AppleScrollAnimationEnabled"]; |
| +} |
| + |
| +} // namespace base |