OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef VersionUtilMac_h | 5 #ifndef VersionUtilMac_h |
6 #define VersionUtilMac_h | 6 #define VersionUtilMac_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 | 9 |
| 10 #include <AvailabilityMacros.h> |
| 11 |
10 namespace blink { | 12 namespace blink { |
11 | 13 |
12 // Mavericks is Mac OS X 10.9, Darwin 13. | 14 namespace internal { |
13 PLATFORM_EXPORT bool IsOSMavericks(); | |
14 | 15 |
15 // Yosemite is Mac OS X 10.10, Darwin 14. | 16 PLATFORM_EXPORT int MacOSXMinorVersion(); |
16 PLATFORM_EXPORT bool IsOSYosemite(); | |
17 | 17 |
18 // El Capitan is Mac OS X 10.11, Darwin 15. | 18 template <int V, int ID> |
19 PLATFORM_EXPORT bool IsOSElCapitan(); | 19 constexpr bool IsOS() |
| 20 { |
| 21 return (!ID || MAC_OS_X_VERSION_MIN_REQUIRED <= ID) && MacOSXMinorVersion()
== V; |
| 22 } |
| 23 |
| 24 } // namespace internal |
| 25 |
| 26 const auto IsOS10_9 = internal::IsOS<9, MAC_OS_X_VERSION_10_9>; |
| 27 const auto IsOS10_10 = internal::IsOS<10, MAC_OS_X_VERSION_10_10>; |
| 28 |
| 29 // Remove these guards when we bump our SDK version |
| 30 #if defined(MAC_OS_X_VERSION_10_11) |
| 31 const auto IsOS10_11 = internal::IsOS<11, MAC_OS_X_VERSION_10_11>; |
| 32 #else |
| 33 const auto IsOS10_11 = internal::IsOS<11, 0>; |
| 34 #endif |
| 35 |
| 36 #if defined(MAC_OS_X_VERSION_10_12) |
| 37 DECLARE_IS_OS_FUNCS(12, MAC_OS_X_VERSION_10_12) |
| 38 #else |
| 39 DECLARE_IS_OS_FUNCS(12, 0) |
| 40 #endif |
20 | 41 |
21 } // namespace blink | 42 } // namespace blink |
22 | 43 |
23 #endif // VersionUtilMac_h | 44 #endif // VersionUtilMac_h |
OLD | NEW |