| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "ui/gfx/animation/animation.h" | 5 #include "ui/gfx/animation/animation.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> |
| 8 |
| 7 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 9 | 11 |
| 10 namespace gfx { | 12 namespace gfx { |
| 11 | 13 |
| 12 // static | 14 // static |
| 13 bool Animation::ScrollAnimationsEnabledBySystem() { | 15 bool Animation::ScrollAnimationsEnabledBySystem() { |
| 14 // Because of sandboxing, OS settings should only be queried from the browser | 16 // Because of sandboxing, OS settings should only be queried from the browser |
| 15 // process. | 17 // process. |
| 16 DCHECK(base::MessageLoopForUI::IsCurrent() || | 18 DCHECK(base::MessageLoopForUI::IsCurrent() || |
| 17 base::MessageLoopForIO::IsCurrent()); | 19 base::MessageLoopForIO::IsCurrent()); |
| 18 | 20 |
| 19 bool enabled = false; | 21 bool enabled = false; |
| 20 id value = nil; | 22 id value = nil; |
| 21 value = [[NSUserDefaults standardUserDefaults] | 23 value = [[NSUserDefaults standardUserDefaults] |
| 22 objectForKey:@"NSScrollAnimationEnabled"]; | 24 objectForKey:@"NSScrollAnimationEnabled"]; |
| 23 if (value) | 25 if (value) |
| 24 enabled = [value boolValue]; | 26 enabled = [value boolValue]; |
| 25 return enabled; | 27 return enabled; |
| 26 } | 28 } |
| 27 | 29 |
| 28 } // namespace gfx | 30 } // namespace gfx |
| OLD | NEW |