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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/mac/mac_util.h" 5 #include "base/mac/mac_util.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #import <IOKit/IOKitLib.h> 8 #import <IOKit/IOKitLib.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <stddef.h> 10 #include <stddef.h>
11 #include <string.h> 11 #include <string.h>
12 #include <sys/utsname.h> 12 #include <sys/utsname.h>
13 #include <sys/xattr.h> 13 #include <sys/xattr.h>
14 14
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/mac/bundle_locations.h" 17 #include "base/mac/bundle_locations.h"
18 #include "base/mac/foundation_util.h" 18 #include "base/mac/foundation_util.h"
19 #include "base/mac/mac_logging.h" 19 #include "base/mac/mac_logging.h"
20 #include "base/mac/scoped_cftyperef.h" 20 #include "base/mac/scoped_cftyperef.h"
21 #include "base/mac/scoped_ioobject.h" 21 #include "base/mac/scoped_ioobject.h"
22 #include "base/mac/scoped_nsobject.h" 22 #include "base/mac/scoped_nsobject.h"
23 #include "base/mac/sdk_forward_declarations.h" 23 #include "base/mac/sdk_forward_declarations.h"
24 #include "base/message_loop/message_loop.h"
24 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
25 #include "base/strings/string_piece.h" 26 #include "base/strings/string_piece.h"
26 #include "base/strings/sys_string_conversions.h" 27 #include "base/strings/sys_string_conversions.h"
27 28
28 namespace base { 29 namespace base {
29 namespace mac { 30 namespace mac {
30 31
31 namespace { 32 namespace {
32 33
33 // The current count of outstanding requests for full screen mode from browser 34 // The current count of outstanding requests for full screen mode from browser
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 StringPiece(begin + number_loc, begin + comma_loc), &major_tmp) || 597 StringPiece(begin + number_loc, begin + comma_loc), &major_tmp) ||
597 !StringToInt( 598 !StringToInt(
598 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) 599 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp))
599 return false; 600 return false;
600 *type = ident.substr(0, number_loc); 601 *type = ident.substr(0, number_loc);
601 *major = major_tmp; 602 *major = major_tmp;
602 *minor = minor_tmp; 603 *minor = minor_tmp;
603 return true; 604 return true;
604 } 605 }
605 606
607 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.
608 // Because of sandboxing, OS settings should only be queried from the browser
609 // process.
610 DCHECK(base::MessageLoopForUI::IsCurrent() ||
611 base::MessageLoopForIO::IsCurrent());
612
613 bool enabled = false;
614 id value = nil;
615 if (base::mac::IsOSMountainLionOrLater()) {
616 value = [[NSUserDefaults standardUserDefaults]
617 objectForKey:@"NSScrollAnimationEnabled"];
618 } else {
619 value = [[NSUserDefaults standardUserDefaults]
620 objectForKey:@"AppleScrollAnimationEnabled"];
621 }
622 if (value)
623 enabled = [value boolValue];
624 return enabled;
625 }
626
627
606 } // namespace mac 628 } // namespace mac
607 } // namespace base 629 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698