OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef BASE_MAC_MAC_UTIL_H_ | 5 #ifndef BASE_MAC_MAC_UTIL_H_ |
6 #define BASE_MAC_MAC_UTIL_H_ | 6 #define BASE_MAC_MAC_UTIL_H_ |
7 | 7 |
8 #include <AvailabilityMacros.h> | 8 #include <AvailabilityMacros.h> |
9 #include <Carbon/Carbon.h> | 9 #include <Carbon/Carbon.h> |
10 #include <string> | 10 #include <string> |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 BASE_EXPORT bool IsOSMountainLionOrEarlier(); | 138 BASE_EXPORT bool IsOSMountainLionOrEarlier(); |
139 BASE_EXPORT bool IsOSMountainLionOrLater(); | 139 BASE_EXPORT bool IsOSMountainLionOrLater(); |
140 | 140 |
141 // Mavericks is Mac OS X 10.9, Darwin 13. | 141 // Mavericks is Mac OS X 10.9, Darwin 13. |
142 BASE_EXPORT bool IsOSMavericks(); | 142 BASE_EXPORT bool IsOSMavericks(); |
143 BASE_EXPORT bool IsOSMavericksOrEarlier(); | 143 BASE_EXPORT bool IsOSMavericksOrEarlier(); |
144 BASE_EXPORT bool IsOSMavericksOrLater(); | 144 BASE_EXPORT bool IsOSMavericksOrLater(); |
145 | 145 |
146 // Yosemite is Mac OS X 10.10, Darwin 14. | 146 // Yosemite is Mac OS X 10.10, Darwin 14. |
147 BASE_EXPORT bool IsOSYosemite(); | 147 BASE_EXPORT bool IsOSYosemite(); |
| 148 BASE_EXPORT bool IsOSYosemiteOrEarlier(); |
148 BASE_EXPORT bool IsOSYosemiteOrLater(); | 149 BASE_EXPORT bool IsOSYosemiteOrLater(); |
149 | 150 |
150 // El Capitan is Mac OS X 10.11, Darwin 15. | 151 // El Capitan is Mac OS X 10.11, Darwin 15. |
151 BASE_EXPORT bool IsOSElCapitan(); | 152 BASE_EXPORT bool IsOSElCapitan(); |
152 BASE_EXPORT bool IsOSElCapitanOrLater(); | 153 BASE_EXPORT bool IsOSElCapitanOrLater(); |
153 | 154 |
154 // This should be infrequently used. It only makes sense to use this to avoid | 155 // This should be infrequently used. It only makes sense to use this to avoid |
155 // codepaths that are very likely to break on future (unreleased, untested, | 156 // codepaths that are very likely to break on future (unreleased, untested, |
156 // unborn) OS releases, or to log when the OS is newer than any known version. | 157 // unborn) OS releases, or to log when the OS is newer than any known version. |
157 BASE_EXPORT bool IsOSLaterThanYosemite_DontCallThis(); | 158 BASE_EXPORT bool IsOSLaterThanElCapitan_DontCallThis(); |
158 | 159 |
159 // Inline functions that are redundant due to version ranges being mutually- | 160 // Inline functions that are redundant due to version ranges being mutually- |
160 // exclusive. | 161 // exclusive. |
161 inline bool IsOSLionOrEarlier() { return !IsOSMountainLionOrLater(); } | 162 inline bool IsOSLionOrEarlier() { return !IsOSMountainLionOrLater(); } |
162 inline bool IsOSMountainLionOrEarlier() { return !IsOSMavericksOrLater(); } | 163 inline bool IsOSMountainLionOrEarlier() { return !IsOSMavericksOrLater(); } |
163 inline bool IsOSMavericksOrEarlier() { return !IsOSYosemiteOrLater(); } | 164 inline bool IsOSMavericksOrEarlier() { return !IsOSYosemiteOrLater(); } |
164 inline bool IsOSYosemiteOrEarlier() { return !IsOSElCapitanOrLater(); } | 165 inline bool IsOSYosemiteOrEarlier() { return !IsOSElCapitanOrLater(); } |
165 | 166 |
166 // When the deployment target is set, the code produced cannot run on earlier | 167 // When the deployment target is set, the code produced cannot run on earlier |
167 // OS releases. That enables some of the IsOS* family to be implemented as | 168 // OS releases. That enables some of the IsOS* family to be implemented as |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 #if defined(MAC_OS_X_VERSION_10_10) && \ | 209 #if defined(MAC_OS_X_VERSION_10_10) && \ |
209 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10 | 210 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10 |
210 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_10 | 211 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_10 |
211 inline bool IsOSYosemiteOrLater() { return true; } | 212 inline bool IsOSYosemiteOrLater() { return true; } |
212 #endif | 213 #endif |
213 | 214 |
214 #if defined(MAC_OS_X_VERSION_10_10) && \ | 215 #if defined(MAC_OS_X_VERSION_10_10) && \ |
215 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10 | 216 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10 |
216 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_10 | 217 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_10 |
217 inline bool IsOSYosemite() { return false; } | 218 inline bool IsOSYosemite() { return false; } |
218 inline bool IsOSLaterThanYosemite_DontCallThis() { return true; } | |
219 #endif | 219 #endif |
220 | 220 |
221 #if defined(MAC_OS_X_VERSION_10_11) && \ | 221 #if defined(MAC_OS_X_VERSION_10_11) && \ |
222 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11 | 222 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11 |
223 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_11 | 223 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_11 |
224 inline bool IsOSElCapitanOrLater() { return true; } | 224 inline bool IsOSElCapitanOrLater() { return true; } |
225 #endif | 225 #endif |
226 | 226 |
227 #if defined(MAC_OS_X_VERSION_10_11) && \ | 227 #if defined(MAC_OS_X_VERSION_10_11) && \ |
228 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_11 | 228 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_11 |
229 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_11 | 229 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_11 |
230 inline bool IsOSElCapitan() { return false; } | 230 inline bool IsOSElCapitan() { return false; } |
| 231 inline bool IsOSLaterThanElCapitan_DontCallThis() { return true; } |
231 #endif | 232 #endif |
232 | 233 |
233 // Retrieve the system's model identifier string from the IOKit registry: | 234 // Retrieve the system's model identifier string from the IOKit registry: |
234 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon | 235 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon |
235 // failure. | 236 // failure. |
236 BASE_EXPORT std::string GetModelIdentifier(); | 237 BASE_EXPORT std::string GetModelIdentifier(); |
237 | 238 |
238 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1). | 239 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1). |
239 // If any error occurs, none of the input pointers are touched. | 240 // If any error occurs, none of the input pointers are touched. |
240 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, | 241 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, |
241 std::string* type, | 242 std::string* type, |
242 int32* major, | 243 int32* major, |
243 int32* minor); | 244 int32* minor); |
244 | 245 |
245 } // namespace mac | 246 } // namespace mac |
246 } // namespace base | 247 } // namespace base |
247 | 248 |
248 #endif // BASE_MAC_MAC_UTIL_H_ | 249 #endif // BASE_MAC_MAC_UTIL_H_ |
OLD | NEW |