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

Side by Side Diff: base/ios/ios_util.mm

Issue 1538743002: Switch to standard integer types in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DEPS roll too Created 4 years, 12 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
« no previous file with comments | « base/ios/ios_util.h ('k') | base/ios/scoped_critical_action.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 7 #import <Foundation/Foundation.h>
8 #include <stddef.h>
8 9
10 #include "base/macros.h"
9 #include "base/sys_info.h" 11 #include "base/sys_info.h"
10 12
11 namespace { 13 namespace {
12 // Return a 3 elements array containing the major, minor and bug fix version of 14 // Return a 3 elements array containing the major, minor and bug fix version of
13 // the OS. 15 // the OS.
14 const int32* OSVersionAsArray() { 16 const int32_t* OSVersionAsArray() {
15 int32* digits = new int32[3]; 17 int32_t* digits = new int32_t[3];
16 base::SysInfo::OperatingSystemVersionNumbers( 18 base::SysInfo::OperatingSystemVersionNumbers(
17 &digits[0], &digits[1], &digits[2]); 19 &digits[0], &digits[1], &digits[2]);
18 return digits; 20 return digits;
19 } 21 }
20 } // namespace 22 } // namespace
21 23
22 namespace base { 24 namespace base {
23 namespace ios { 25 namespace ios {
24 26
25 // When dropping iOS7 support, also address issues listed in crbug.com/502968. 27 // When dropping iOS7 support, also address issues listed in crbug.com/502968.
26 bool IsRunningOnIOS8OrLater() { 28 bool IsRunningOnIOS8OrLater() {
27 return IsRunningOnOrLater(8, 0, 0); 29 return IsRunningOnOrLater(8, 0, 0);
28 } 30 }
29 31
30 bool IsRunningOnIOS9OrLater() { 32 bool IsRunningOnIOS9OrLater() {
31 return IsRunningOnOrLater(9, 0, 0); 33 return IsRunningOnOrLater(9, 0, 0);
32 } 34 }
33 35
34 bool IsRunningOnOrLater(int32 major, int32 minor, int32 bug_fix) { 36 bool IsRunningOnOrLater(int32_t major, int32_t minor, int32_t bug_fix) {
35 static const int32* current_version = OSVersionAsArray(); 37 static const int32_t* current_version = OSVersionAsArray();
36 int32 version[] = { major, minor, bug_fix }; 38 int32_t version[] = {major, minor, bug_fix};
37 for (size_t i = 0; i < arraysize(version); i++) { 39 for (size_t i = 0; i < arraysize(version); i++) {
38 if (current_version[i] != version[i]) 40 if (current_version[i] != version[i])
39 return current_version[i] > version[i]; 41 return current_version[i] > version[i];
40 } 42 }
41 return true; 43 return true;
42 } 44 }
43 45
44 bool IsInForcedRTL() { 46 bool IsInForcedRTL() {
45 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; 47 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
46 return [defaults boolForKey:@"NSForceRightToLeftWritingDirection"]; 48 return [defaults boolForKey:@"NSForceRightToLeftWritingDirection"];
47 } 49 }
48 50
49 } // namespace ios 51 } // namespace ios
50 } // namespace base 52 } // namespace base
OLDNEW
« no previous file with comments | « base/ios/ios_util.h ('k') | base/ios/scoped_critical_action.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698