Compute can_use_lcd_text using property trees.
[chromium-blink-merge.git] / base / ios / ios_util.mm
blob817eec4d7e46749214ed6000801b79b851d45257
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"
9 namespace {
10 // Return a 3 elements array containing the major, minor and bug fix version of
11 // the OS.
12 const int32* OSVersionAsArray() {
13   int32* digits = new int32[3];
14   base::SysInfo::OperatingSystemVersionNumbers(
15       &digits[0], &digits[1], &digits[2]);
16   return digits;
18 }  // namespace
20 namespace base {
21 namespace ios {
23 // When dropping iOS7 support, also address issues listed in crbug.com/502968.
24 bool IsRunningOnIOS8OrLater() {
25   return IsRunningOnOrLater(8, 0, 0);
28 bool IsRunningOnOrLater(int32 major, int32 minor, int32 bug_fix) {
29   static const int32* current_version = OSVersionAsArray();
30   int32 version[] = { major, minor, bug_fix };
31   for (size_t i = 0; i < arraysize(version); i++) {
32     if (current_version[i] != version[i])
33       return current_version[i] > version[i];
34   }
35   return true;
38 }  // namespace ios
39 }  // namespace base