Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <AvailabilityMacros.h> | 9 #include <AvailabilityMacros.h> |
| 10 #include <Carbon/Carbon.h> | 10 #include <Carbon/Carbon.h> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 BASE_EXPORT bool IsOSLeopard(); | 131 BASE_EXPORT bool IsOSLeopard(); |
| 132 BASE_EXPORT bool IsOSLeopardOrEarlier(); | 132 BASE_EXPORT bool IsOSLeopardOrEarlier(); |
| 133 | 133 |
| 134 // Snow Leopard is Mac OS X 10.6, Darwin 10. | 134 // Snow Leopard is Mac OS X 10.6, Darwin 10. |
| 135 BASE_EXPORT bool IsOSSnowLeopard(); | 135 BASE_EXPORT bool IsOSSnowLeopard(); |
| 136 BASE_EXPORT bool IsOSSnowLeopardOrEarlier(); | 136 BASE_EXPORT bool IsOSSnowLeopardOrEarlier(); |
| 137 BASE_EXPORT bool IsOSSnowLeopardOrLater(); | 137 BASE_EXPORT bool IsOSSnowLeopardOrLater(); |
| 138 | 138 |
| 139 // Lion is Mac OS X 10.7, Darwin 11. | 139 // Lion is Mac OS X 10.7, Darwin 11. |
| 140 BASE_EXPORT bool IsOSLion(); | 140 BASE_EXPORT bool IsOSLion(); |
| 141 BASE_EXPORT bool IsOSLionOrEarlier(); | |
| 141 BASE_EXPORT bool IsOSLionOrLater(); | 142 BASE_EXPORT bool IsOSLionOrLater(); |
| 142 | 143 |
| 144 // Mountain Lion is Mac OS X 10.8, Darwin 12. | |
| 145 BASE_EXPORT bool IsOSMountainLion(); | |
| 146 BASE_EXPORT bool IsOSMountainLionOrEarlier(); | |
|
Mark Mentovai
2012/03/14 16:55:41
xxx
| |
| 147 BASE_EXPORT bool IsOSMountainLionOrLater(); | |
| 148 | |
| 143 // This should be infrequently used. It only makes sense to use this to avoid | 149 // This should be infrequently used. It only makes sense to use this to avoid |
| 144 // codepaths that are very likely to break on future (unreleased, untested, | 150 // codepaths that are very likely to break on future (unreleased, untested, |
| 145 // unborn) OS releases. | 151 // unborn) OS releases. |
| 146 BASE_EXPORT bool IsOSLaterThanLion(); | 152 BASE_EXPORT |
| 153 bool IsOSDangerouslyLaterThanMountainLionForUseByCFAllocatorReplacement(); | |
| 147 | 154 |
| 148 // When the deployment target is set, the code produced cannot run on earlier | 155 // When the deployment target is set, the code produced cannot run on earlier |
| 149 // OS releases. That enables some of the IsOS* family to be implemented as | 156 // OS releases. That enables some of the IsOS* family to be implemented as |
| 150 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro | 157 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro |
| 151 // contains the value of the deployment target. | 158 // contains the value of the deployment target. |
| 152 | 159 |
| 153 #if defined(MAC_OS_X_VERSION_10_6) && \ | 160 #if defined(MAC_OS_X_VERSION_10_6) && \ |
| 154 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 | 161 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 |
| 155 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_6 | 162 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_6 |
| 156 inline bool IsOSLeopard() { return false; } | 163 inline bool IsOSLeopard() { return false; } |
| 157 inline bool IsOSLeopardOrEarlier() { return false; } | 164 inline bool IsOSLeopardOrEarlier() { return false; } |
| 158 inline bool IsOSSnowLeopardOrLater() { return true; } | 165 inline bool IsOSSnowLeopardOrLater() { return true; } |
| 159 #endif | 166 #endif |
| 160 | 167 |
| 161 #if defined(MAC_OS_X_VERSION_10_7) && \ | 168 #if defined(MAC_OS_X_VERSION_10_7) && \ |
| 162 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 | 169 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 |
| 163 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7 | 170 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7 |
| 164 inline bool IsOSSnowLeopard() { return false; } | 171 inline bool IsOSSnowLeopard() { return false; } |
| 165 inline bool IsOSSnowLeopardOrEarlier() { return false; } | 172 inline bool IsOSSnowLeopardOrEarlier() { return false; } |
| 166 inline bool IsOSLionOrLater() { return true; } | 173 inline bool IsOSLionOrLater() { return true; } |
| 167 #endif | 174 #endif |
| 168 | 175 |
| 169 #if defined(MAC_OS_X_VERSION_10_7) && \ | 176 #if defined(MAC_OS_X_VERSION_10_7) && \ |
| 170 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_7 | 177 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_7 |
| 171 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7 | 178 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7 |
| 172 inline bool IsOSLion() { return false; } | 179 inline bool IsOSLion() { return false; } |
| 173 inline bool IsOSLaterThanLion() { return true; } | 180 inline bool IsOSLionOrEarlier() { return false; } |
| 181 #endif | |
| 182 | |
| 183 #if defined(MAC_OS_X_VERSION_10_8) && \ | |
| 184 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8 | |
| 185 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_8 | |
| 186 inline bool IsOSMountainLionOrLater() { return true; } | |
| 187 #endif | |
| 188 | |
| 189 #if defined(MAC_OS_X_VERSION_10_8) && \ | |
| 190 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8 | |
| 191 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8 | |
| 192 inline bool IsOSMountainLion() { return false; } | |
| 193 inline bool IsOSMountainLionOrEarlier() { return false; } | |
|
Mark Mentovai
2012/03/14 16:55:41
xxx
| |
| 194 inline bool IsOSDangerouslyLaterThanMountainLionForUseByCFAllocatorReplacement() | |
| 195 { | |
| 196 return true; | |
| 197 } | |
| 174 #endif | 198 #endif |
| 175 | 199 |
| 176 // Retrieve the system's model identifier string from the IOKit registry: | 200 // Retrieve the system's model identifier string from the IOKit registry: |
| 177 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon | 201 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon |
| 178 // failure. | 202 // failure. |
| 179 BASE_EXPORT std::string GetModelIdentifier(); | 203 BASE_EXPORT std::string GetModelIdentifier(); |
| 180 | 204 |
| 181 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1). | 205 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1). |
| 182 // If any error occurs, none of the input pointers are touched. | 206 // If any error occurs, none of the input pointers are touched. |
| 183 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, | 207 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, |
| 184 std::string* type, | 208 std::string* type, |
| 185 int32* major, | 209 int32* major, |
| 186 int32* minor); | 210 int32* minor); |
| 187 | 211 |
| 188 } // namespace mac | 212 } // namespace mac |
| 189 } // namespace base | 213 } // namespace base |
| 190 | 214 |
| 191 #endif // BASE_MAC_MAC_UTIL_H_ | 215 #endif // BASE_MAC_MAC_UTIL_H_ |
| OLD | NEW |