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

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

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
« no previous file with comments | « base/ios/ios_util.h ('k') | base/ios/ns_error_util.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 #include "base/sys_info.h" 7 #include "base/sys_info.h"
8 8
9 namespace { 9 namespace {
10 // Return a 3 elements array containing the major, minor and bug fix version of 10 // Return a 3 elements array containing the major, minor and bug fix version of
11 // the OS. 11 // the OS.
12 const int32* OSVersionAsArray() { 12 const int32* OSVersionAsArray() {
13 int32* digits = new int32[3]; 13 int32* digits = new int32[3];
14 base::SysInfo::OperatingSystemVersionNumbers( 14 base::SysInfo::OperatingSystemVersionNumbers(
15 &digits[0], &digits[1], &digits[2]); 15 &digits[0], &digits[1], &digits[2]);
16 return digits; 16 return digits;
17 } 17 }
18 } // namespace 18 } // namespace
19 19
20 namespace base { 20 namespace base {
21 namespace ios { 21 namespace ios {
22 22
23 // When dropping iOS7 support, also address issues listed in crbug.com/502968.
23 bool IsRunningOnIOS8OrLater() { 24 bool IsRunningOnIOS8OrLater() {
24 return IsRunningOnOrLater(8, 0, 0); 25 return IsRunningOnOrLater(8, 0, 0);
25 } 26 }
26 27
28 bool IsRunningOnIOS9OrLater() {
29 return IsRunningOnOrLater(9, 0, 0);
30 }
31
27 bool IsRunningOnOrLater(int32 major, int32 minor, int32 bug_fix) { 32 bool IsRunningOnOrLater(int32 major, int32 minor, int32 bug_fix) {
28 static const int32* current_version = OSVersionAsArray(); 33 static const int32* current_version = OSVersionAsArray();
29 int32 version[] = { major, minor, bug_fix }; 34 int32 version[] = { major, minor, bug_fix };
30 for (size_t i = 0; i < arraysize(version); i++) { 35 for (size_t i = 0; i < arraysize(version); i++) {
31 if (current_version[i] != version[i]) 36 if (current_version[i] != version[i])
32 return current_version[i] > version[i]; 37 return current_version[i] > version[i];
33 } 38 }
34 return true; 39 return true;
35 } 40 }
36 41
37 } // namespace ios 42 } // namespace ios
38 } // namespace base 43 } // namespace base
OLDNEW
« no previous file with comments | « base/ios/ios_util.h ('k') | base/ios/ns_error_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698