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 <stdint.h> | 10 #include <stdint.h> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // Remove the quarantine xattr from the given file. Returns false if there was | 107 // Remove the quarantine xattr from the given file. Returns false if there was |
108 // an error, or true otherwise. | 108 // an error, or true otherwise. |
109 BASE_EXPORT bool RemoveQuarantineAttribute(const FilePath& file_path); | 109 BASE_EXPORT bool RemoveQuarantineAttribute(const FilePath& file_path); |
110 | 110 |
111 // Run-time OS version checks. Use these instead of | 111 // Run-time OS version checks. Use these instead of |
112 // base::SysInfo::OperatingSystemVersionNumbers. Prefer the "OrEarlier" and | 112 // base::SysInfo::OperatingSystemVersionNumbers. Prefer the "OrEarlier" and |
113 // "OrLater" variants to those that check for a specific version, unless you | 113 // "OrLater" variants to those that check for a specific version, unless you |
114 // know for sure that you need to check for a specific version. | 114 // know for sure that you need to check for a specific version. |
115 | 115 |
116 // Lion is Mac OS X 10.7, Darwin 11. | |
117 BASE_EXPORT bool IsOSLion(); | |
118 BASE_EXPORT bool IsOSLionOrEarlier(); | |
119 BASE_EXPORT bool IsOSLionOrLater(); | |
120 | |
121 // Mountain Lion is Mac OS X 10.8, Darwin 12. | 116 // Mountain Lion is Mac OS X 10.8, Darwin 12. |
122 BASE_EXPORT bool IsOSMountainLion(); | 117 BASE_EXPORT bool IsOSMountainLion(); |
123 BASE_EXPORT bool IsOSMountainLionOrEarlier(); | 118 BASE_EXPORT bool IsOSMountainLionOrEarlier(); |
124 BASE_EXPORT bool IsOSMountainLionOrLater(); | 119 BASE_EXPORT bool IsOSMountainLionOrLater(); |
125 | 120 |
126 // Mavericks is Mac OS X 10.9, Darwin 13. | 121 // Mavericks is Mac OS X 10.9, Darwin 13. |
127 BASE_EXPORT bool IsOSMavericks(); | 122 BASE_EXPORT bool IsOSMavericks(); |
128 BASE_EXPORT bool IsOSMavericksOrEarlier(); | 123 BASE_EXPORT bool IsOSMavericksOrEarlier(); |
129 BASE_EXPORT bool IsOSMavericksOrLater(); | 124 BASE_EXPORT bool IsOSMavericksOrLater(); |
130 | 125 |
131 // Yosemite is Mac OS X 10.10, Darwin 14. | 126 // Yosemite is Mac OS X 10.10, Darwin 14. |
132 BASE_EXPORT bool IsOSYosemite(); | 127 BASE_EXPORT bool IsOSYosemite(); |
133 BASE_EXPORT bool IsOSYosemiteOrEarlier(); | 128 BASE_EXPORT bool IsOSYosemiteOrEarlier(); |
134 BASE_EXPORT bool IsOSYosemiteOrLater(); | 129 BASE_EXPORT bool IsOSYosemiteOrLater(); |
135 | 130 |
136 // El Capitan is Mac OS X 10.11, Darwin 15. | 131 // El Capitan is Mac OS X 10.11, Darwin 15. |
137 BASE_EXPORT bool IsOSElCapitan(); | 132 BASE_EXPORT bool IsOSElCapitan(); |
138 BASE_EXPORT bool IsOSElCapitanOrLater(); | 133 BASE_EXPORT bool IsOSElCapitanOrLater(); |
139 | 134 |
140 // This should be infrequently used. It only makes sense to use this to avoid | 135 // This should be infrequently used. It only makes sense to use this to avoid |
141 // codepaths that are very likely to break on future (unreleased, untested, | 136 // codepaths that are very likely to break on future (unreleased, untested, |
142 // unborn) OS releases, or to log when the OS is newer than any known version. | 137 // unborn) OS releases, or to log when the OS is newer than any known version. |
143 BASE_EXPORT bool IsOSLaterThanElCapitan_DontCallThis(); | 138 BASE_EXPORT bool IsOSLaterThanElCapitan_DontCallThis(); |
144 | 139 |
145 // Inline functions that are redundant due to version ranges being mutually- | 140 // Inline functions that are redundant due to version ranges being mutually- |
146 // exclusive. | 141 // exclusive. |
147 inline bool IsOSLionOrEarlier() { return !IsOSMountainLionOrLater(); } | |
148 inline bool IsOSMountainLionOrEarlier() { return !IsOSMavericksOrLater(); } | 142 inline bool IsOSMountainLionOrEarlier() { return !IsOSMavericksOrLater(); } |
149 inline bool IsOSMavericksOrEarlier() { return !IsOSYosemiteOrLater(); } | 143 inline bool IsOSMavericksOrEarlier() { return !IsOSYosemiteOrLater(); } |
150 inline bool IsOSYosemiteOrEarlier() { return !IsOSElCapitanOrLater(); } | 144 inline bool IsOSYosemiteOrEarlier() { return !IsOSElCapitanOrLater(); } |
151 | 145 |
152 // 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 |
153 // 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 |
154 // 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 |
155 // contains the value of the deployment target. | 149 // contains the value of the deployment target. |
156 | 150 |
157 #if defined(MAC_OS_X_VERSION_10_7) && \ | |
158 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 | |
159 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7 | |
160 inline bool IsOSLionOrLater() { return true; } | |
161 #endif | |
162 | |
163 #if defined(MAC_OS_X_VERSION_10_7) && \ | |
164 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_7 | |
165 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7 | |
166 inline bool IsOSLion() { return false; } | |
167 #endif | |
168 | |
169 #if defined(MAC_OS_X_VERSION_10_8) && \ | 151 #if defined(MAC_OS_X_VERSION_10_8) && \ |
170 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8 | 152 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8 |
171 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_8 | 153 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_8 |
172 inline bool IsOSMountainLionOrLater() { return true; } | 154 inline bool IsOSMountainLionOrLater() { return true; } |
173 #endif | 155 #endif |
174 | 156 |
175 #if defined(MAC_OS_X_VERSION_10_8) && \ | 157 #if defined(MAC_OS_X_VERSION_10_8) && \ |
176 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8 | 158 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8 |
177 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8 | 159 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8 |
178 inline bool IsOSMountainLion() { return false; } | 160 inline bool IsOSMountainLion() { return false; } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 // If any error occurs, none of the input pointers are touched. | 206 // If any error occurs, none of the input pointers are touched. |
225 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, | 207 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, |
226 std::string* type, | 208 std::string* type, |
227 int32_t* major, | 209 int32_t* major, |
228 int32_t* minor); | 210 int32_t* minor); |
229 | 211 |
230 } // namespace mac | 212 } // namespace mac |
231 } // namespace base | 213 } // namespace base |
232 | 214 |
233 #endif // BASE_MAC_MAC_UTIL_H_ | 215 #endif // BASE_MAC_MAC_UTIL_H_ |
OLD | NEW |