OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ios/ios_util.h" | 5 #include "base/ios/ios_util.h" |
6 | 6 |
| 7 #import <Foundation/Foundation.h> |
| 8 |
7 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
8 | 10 |
9 namespace { | 11 namespace { |
10 // Return a 3 elements array containing the major, minor and bug fix version of | 12 // Return a 3 elements array containing the major, minor and bug fix version of |
11 // the OS. | 13 // the OS. |
12 const int32* OSVersionAsArray() { | 14 const int32* OSVersionAsArray() { |
13 int32* digits = new int32[3]; | 15 int32* digits = new int32[3]; |
14 base::SysInfo::OperatingSystemVersionNumbers( | 16 base::SysInfo::OperatingSystemVersionNumbers( |
15 &digits[0], &digits[1], &digits[2]); | 17 &digits[0], &digits[1], &digits[2]); |
16 return digits; | 18 return digits; |
(...skipping 15 matching lines...) Expand all Loading... |
32 bool IsRunningOnOrLater(int32 major, int32 minor, int32 bug_fix) { | 34 bool IsRunningOnOrLater(int32 major, int32 minor, int32 bug_fix) { |
33 static const int32* current_version = OSVersionAsArray(); | 35 static const int32* current_version = OSVersionAsArray(); |
34 int32 version[] = { major, minor, bug_fix }; | 36 int32 version[] = { major, minor, bug_fix }; |
35 for (size_t i = 0; i < arraysize(version); i++) { | 37 for (size_t i = 0; i < arraysize(version); i++) { |
36 if (current_version[i] != version[i]) | 38 if (current_version[i] != version[i]) |
37 return current_version[i] > version[i]; | 39 return current_version[i] > version[i]; |
38 } | 40 } |
39 return true; | 41 return true; |
40 } | 42 } |
41 | 43 |
| 44 bool IsInForcedRTL() { |
| 45 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
| 46 return [defaults boolForKey:@"AppleTextDirection"]; |
| 47 } |
| 48 |
42 } // namespace ios | 49 } // namespace ios |
43 } // namespace base | 50 } // namespace base |
OLD | NEW |