Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2958)

Unified Diff: base/mac/mac_util.mm

Issue 1653003002: Make scrollAnimatorEnabled work on Mac like it does on other platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also allow IO ML for unit tests Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/mac/mac_util.mm
diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm
index 75d53c90961086c6225b352981d181a8d5733524..02ae6265b64a7a374ecaf7c069eb633c83f701bc 100644
--- a/base/mac/mac_util.mm
+++ b/base/mac/mac_util.mm
@@ -21,6 +21,7 @@
#include "base/mac/scoped_ioobject.h"
#include "base/mac/scoped_nsobject.h"
#include "base/mac/sdk_forward_declarations.h"
+#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/sys_string_conversions.h"
@@ -603,5 +604,26 @@ bool ParseModelIdentifier(const std::string& ident,
return true;
}
+bool IsScrollAnimationEnabled() {
Robert Sesek 2016/02/08 17:39:51 I don't think this needs to be in base, since it's
bokan 2016/02/08 20:55:06 Done. I moved the Windows bits into animation_win.
+ // Because of sandboxing, OS settings should only be queried from the browser
+ // process.
+ DCHECK(base::MessageLoopForUI::IsCurrent() ||
+ base::MessageLoopForIO::IsCurrent());
+
+ bool enabled = false;
+ id value = nil;
+ if (base::mac::IsOSMountainLionOrLater()) {
+ value = [[NSUserDefaults standardUserDefaults]
+ objectForKey:@"NSScrollAnimationEnabled"];
+ } else {
+ value = [[NSUserDefaults standardUserDefaults]
+ objectForKey:@"AppleScrollAnimationEnabled"];
+ }
+ if (value)
+ enabled = [value boolValue];
+ return enabled;
+}
+
+
} // namespace mac
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698