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

Unified Diff: base/sys_info_ios.mm

Issue 11031066: Adding utility method to test the version of the OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix namespace Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« base/ios/device_util.mm ('K') | « base/sys_info.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info_ios.mm
diff --git a/base/sys_info_ios.mm b/base/sys_info_ios.mm
index 8b1ffd4521192f0f9db7e9c2b3b6621a4e6d1838..8b25ef5c631eb6d0dd4d4ff00548aacf7d216c00 100644
--- a/base/sys_info_ios.mm
+++ b/base/sys_info_ios.mm
@@ -76,4 +76,36 @@ std::string SysInfo::CPUModelName() {
return std::string();
}
+// static
+bool SysInfo::IsRunningOnIOS5OrLater() {
+ return IsRunningOnOrLater(5, 0, 0);
+}
+
+// static
+bool SysInfo::IsRunningOnIOS6OrLater() {
+ return IsRunningOnOrLater(6, 0, 0);
+}
+
+// static
+bool SysInfo::IsRunningOnOrLater(int major, int minor, int bugFix) {
+ static int32 digits[3] = { 0, 0, 0 };
+ if (digits[0] == 0) {
+ OperatingSystemVersionNumbers(&digits[0], &digits[1], &digits[2]);
+ }
+ if (digits[0] < major)
+ return NO;
+ if (digits[0] > major)
+ return YES;
+ // digits[0] == major
+ if (digits[1] < minor)
+ return NO;
+ if (digits[1] > minor)
+ return YES;
+ // digits[1] == minor
+ if (digits[2] < bugFix)
+ return NO;
+ // digits[2] >= bugFix
+ return YES;
+}
+
} // namespace base
« base/ios/device_util.mm ('K') | « base/sys_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698