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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // 'Login Item' with 'hide on startup' flag. Used to suppress opening windows. | 121 // 'Login Item' with 'hide on startup' flag. Used to suppress opening windows. |
122 BASE_EXPORT bool WasLaunchedAsHiddenLoginItem(); | 122 BASE_EXPORT bool WasLaunchedAsHiddenLoginItem(); |
123 | 123 |
124 // Run-time OS version checks. Use these instead of | 124 // Run-time OS version checks. Use these instead of |
125 // base::SysInfo::OperatingSystemVersionNumbers. Prefer the "OrEarlier" and | 125 // base::SysInfo::OperatingSystemVersionNumbers. Prefer the "OrEarlier" and |
126 // "OrLater" variants to those that check for a specific version, unless you | 126 // "OrLater" variants to those that check for a specific version, unless you |
127 // know for sure that you need to check for a specific version. | 127 // know for sure that you need to check for a specific version. |
128 | 128 |
129 // Snow Leopard is Mac OS X 10.6, Darwin 10. | 129 // Snow Leopard is Mac OS X 10.6, Darwin 10. |
130 BASE_EXPORT bool IsOSSnowLeopard(); | 130 BASE_EXPORT bool IsOSSnowLeopard(); |
131 BASE_EXPORT bool IsOSSnowLeopardOrEarlier(); | |
132 BASE_EXPORT bool IsOSSnowLeopardOrLater(); | |
133 | 131 |
134 // Lion is Mac OS X 10.7, Darwin 11. | 132 // Lion is Mac OS X 10.7, Darwin 11. |
135 BASE_EXPORT bool IsOSLion(); | 133 BASE_EXPORT bool IsOSLion(); |
136 BASE_EXPORT bool IsOSLionOrEarlier(); | 134 BASE_EXPORT bool IsOSLionOrEarlier(); |
137 BASE_EXPORT bool IsOSLionOrLater(); | 135 BASE_EXPORT bool IsOSLionOrLater(); |
138 | 136 |
139 // Mountain Lion is Mac OS X 10.8, Darwin 12. | 137 // Mountain Lion is Mac OS X 10.8, Darwin 12. |
140 BASE_EXPORT bool IsOSMountainLion(); | 138 BASE_EXPORT bool IsOSMountainLion(); |
141 BASE_EXPORT bool IsOSMountainLionOrLater(); | 139 BASE_EXPORT bool IsOSMountainLionOrLater(); |
142 | 140 |
143 // 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 |
144 // codepaths that are very likely to break on future (unreleased, untested, | 142 // codepaths that are very likely to break on future (unreleased, untested, |
145 // unborn) OS releases. | 143 // unborn) OS releases. |
146 BASE_EXPORT | 144 BASE_EXPORT |
147 bool IsOSDangerouslyLaterThanMountainLionForUseByCFAllocatorReplacement(); | 145 bool IsOSDangerouslyLaterThanMountainLionForUseByCFAllocatorReplacement(); |
148 | 146 |
149 // 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 |
150 // 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 |
151 // 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 |
152 // contains the value of the deployment target. | 150 // contains the value of the deployment target. |
153 | 151 |
154 #if defined(MAC_OS_X_VERSION_10_6) && \ | |
155 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 | |
156 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_6 | |
157 inline bool IsOSSnowLeopardOrLater() { return true; } | |
158 #endif | |
159 | |
160 #if defined(MAC_OS_X_VERSION_10_7) && \ | 152 #if defined(MAC_OS_X_VERSION_10_7) && \ |
161 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 |
162 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7 | 154 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7 |
163 inline bool IsOSSnowLeopard() { return false; } | 155 inline bool IsOSSnowLeopard() { return false; } |
164 inline bool IsOSSnowLeopardOrEarlier() { return false; } | |
165 inline bool IsOSLionOrLater() { return true; } | 156 inline bool IsOSLionOrLater() { return true; } |
166 #endif | 157 #endif |
167 | 158 |
168 #if defined(MAC_OS_X_VERSION_10_7) && \ | 159 #if defined(MAC_OS_X_VERSION_10_7) && \ |
169 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_7 | 160 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_7 |
170 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7 | 161 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7 |
171 inline bool IsOSLion() { return false; } | 162 inline bool IsOSLion() { return false; } |
172 inline bool IsOSLionOrEarlier() { return false; } | 163 inline bool IsOSLionOrEarlier() { return false; } |
173 #endif | 164 #endif |
174 | 165 |
(...skipping 22 matching lines...) Expand all Loading... |
197 // If any error occurs, none of the input pointers are touched. | 188 // If any error occurs, none of the input pointers are touched. |
198 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, | 189 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, |
199 std::string* type, | 190 std::string* type, |
200 int32* major, | 191 int32* major, |
201 int32* minor); | 192 int32* minor); |
202 | 193 |
203 } // namespace mac | 194 } // namespace mac |
204 } // namespace base | 195 } // namespace base |
205 | 196 |
206 #endif // BASE_MAC_MAC_UTIL_H_ | 197 #endif // BASE_MAC_MAC_UTIL_H_ |
OLD | NEW |