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