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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 BASE_EXPORT bool IsOSLion(); | 133 BASE_EXPORT bool IsOSLion(); |
134 BASE_EXPORT bool IsOSLionOrEarlier(); | 134 BASE_EXPORT bool IsOSLionOrEarlier(); |
135 BASE_EXPORT bool IsOSLionOrLater(); | 135 BASE_EXPORT bool IsOSLionOrLater(); |
136 | 136 |
137 // Mountain Lion is Mac OS X 10.8, Darwin 12. | 137 // Mountain Lion is Mac OS X 10.8, Darwin 12. |
138 BASE_EXPORT bool IsOSMountainLion(); | 138 BASE_EXPORT bool IsOSMountainLion(); |
139 BASE_EXPORT bool IsOSMountainLionOrLater(); | 139 BASE_EXPORT bool IsOSMountainLionOrLater(); |
140 | 140 |
141 // This should be infrequently used. It only makes sense to use this to avoid | 141 // This should be infrequently used. It only makes sense to use this to avoid |
142 // codepaths that are very likely to break on future (unreleased, untested, | 142 // codepaths that are very likely to break on future (unreleased, untested, |
143 // unborn) OS releases, or to log when the OS is newer than any known version. | 143 // unborn) OS releases. |
144 BASE_EXPORT bool IsOSLaterThanMountainLion_DontCallThis(); | 144 BASE_EXPORT |
| 145 bool IsOSDangerouslyLaterThanMountainLionForUseByCFAllocatorReplacement(); |
145 | 146 |
146 // When the deployment target is set, the code produced cannot run on earlier | 147 // When the deployment target is set, the code produced cannot run on earlier |
147 // OS releases. That enables some of the IsOS* family to be implemented as | 148 // OS releases. That enables some of the IsOS* family to be implemented as |
148 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro | 149 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro |
149 // contains the value of the deployment target. | 150 // contains the value of the deployment target. |
150 | 151 |
151 #if defined(MAC_OS_X_VERSION_10_7) && \ | 152 #if defined(MAC_OS_X_VERSION_10_7) && \ |
152 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 | 153 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 |
153 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7 | 154 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7 |
154 inline bool IsOSSnowLeopard() { return false; } | 155 inline bool IsOSSnowLeopard() { return false; } |
(...skipping 10 matching lines...) Expand all Loading... |
165 #if defined(MAC_OS_X_VERSION_10_8) && \ | 166 #if defined(MAC_OS_X_VERSION_10_8) && \ |
166 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8 | 167 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8 |
167 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_8 | 168 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_8 |
168 inline bool IsOSMountainLionOrLater() { return true; } | 169 inline bool IsOSMountainLionOrLater() { return true; } |
169 #endif | 170 #endif |
170 | 171 |
171 #if defined(MAC_OS_X_VERSION_10_8) && \ | 172 #if defined(MAC_OS_X_VERSION_10_8) && \ |
172 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8 | 173 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8 |
173 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8 | 174 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8 |
174 inline bool IsOSMountainLion() { return false; } | 175 inline bool IsOSMountainLion() { return false; } |
175 inline bool IsOSLaterThanMountainLion_DontCallThis() { | 176 inline bool IsOSDangerouslyLaterThanMountainLionForUseByCFAllocatorReplacement() |
| 177 { |
176 return true; | 178 return true; |
177 } | 179 } |
178 #endif | 180 #endif |
179 | 181 |
180 // Retrieve the system's model identifier string from the IOKit registry: | 182 // Retrieve the system's model identifier string from the IOKit registry: |
181 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon | 183 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon |
182 // failure. | 184 // failure. |
183 BASE_EXPORT std::string GetModelIdentifier(); | 185 BASE_EXPORT std::string GetModelIdentifier(); |
184 | 186 |
185 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1). | 187 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1). |
186 // If any error occurs, none of the input pointers are touched. | 188 // If any error occurs, none of the input pointers are touched. |
187 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, | 189 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, |
188 std::string* type, | 190 std::string* type, |
189 int32* major, | 191 int32* major, |
190 int32* minor); | 192 int32* minor); |
191 | 193 |
192 } // namespace mac | 194 } // namespace mac |
193 } // namespace base | 195 } // namespace base |
194 | 196 |
195 #endif // BASE_MAC_MAC_UTIL_H_ | 197 #endif // BASE_MAC_MAC_UTIL_H_ |
OLD | NEW |