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
3 // found in the LICENSE file.
5 #include "base/ios/ios_util.h"
7 #include "base/sys_info.h"
10 // Return a 3 elements array containing the major, minor and bug fix version of
12 const int32* OSVersionAsArray() {
13 int32* digits = new int32[3];
14 base::SysInfo::OperatingSystemVersionNumbers(
15 &digits[0], &digits[1], &digits[2]);
23 bool IsRunningOnIOS8OrLater() {
24 return IsRunningOnOrLater(8, 0, 0);
27 bool IsRunningOnOrLater(int32 major, int32 minor, int32 bug_fix) {
28 static const int32* current_version = OSVersionAsArray();
29 int32 version[] = { major, minor, bug_fix };
30 for (size_t i = 0; i < arraysize(version); i++) {
31 if (current_version[i] != version[i])
32 return current_version[i] > version[i];