Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: base/mac/mac_util.h

Issue 1224283006: Update OS version functions for OS X 10.11 El Capitan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: For rsesek Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/mac/mac_util.mm » ('j') | base/mac/mac_util_unittest.mm » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 BASE_EXPORT bool IsOSMountainLionOrEarlier(); 138 BASE_EXPORT bool IsOSMountainLionOrEarlier();
139 BASE_EXPORT bool IsOSMountainLionOrLater(); 139 BASE_EXPORT bool IsOSMountainLionOrLater();
140 140
141 // Mavericks is Mac OS X 10.9, Darwin 13. 141 // Mavericks is Mac OS X 10.9, Darwin 13.
142 BASE_EXPORT bool IsOSMavericks(); 142 BASE_EXPORT bool IsOSMavericks();
143 BASE_EXPORT bool IsOSMavericksOrEarlier(); 143 BASE_EXPORT bool IsOSMavericksOrEarlier();
144 BASE_EXPORT bool IsOSMavericksOrLater(); 144 BASE_EXPORT bool IsOSMavericksOrLater();
145 145
146 // Yosemite is Mac OS X 10.10, Darwin 14. 146 // Yosemite is Mac OS X 10.10, Darwin 14.
147 BASE_EXPORT bool IsOSYosemite(); 147 BASE_EXPORT bool IsOSYosemite();
148 BASE_EXPORT bool IsOSYosemiteOrEarlier();
148 BASE_EXPORT bool IsOSYosemiteOrLater(); 149 BASE_EXPORT bool IsOSYosemiteOrLater();
149 150
151 // El Capitan is Mac OS X 10.11, Darwin 15.
152 BASE_EXPORT bool IsOSElCapitan();
153 BASE_EXPORT bool IsOSElCapitanOrLater();
154
150 // This should be infrequently used. It only makes sense to use this to avoid 155 // This should be infrequently used. It only makes sense to use this to avoid
151 // codepaths that are very likely to break on future (unreleased, untested, 156 // codepaths that are very likely to break on future (unreleased, untested,
152 // unborn) OS releases, or to log when the OS is newer than any known version. 157 // unborn) OS releases, or to log when the OS is newer than any known version.
153 BASE_EXPORT bool IsOSLaterThanYosemite_DontCallThis(); 158 BASE_EXPORT bool IsOSLaterThanElCapitan_DontCallThis();
154 159
155 // Inline functions that are redundant due to version ranges being mutually- 160 // Inline functions that are redundant due to version ranges being mutually-
156 // exclusive. 161 // exclusive.
157 inline bool IsOSLionOrEarlier() { return !IsOSMountainLionOrLater(); } 162 inline bool IsOSLionOrEarlier() { return !IsOSMountainLionOrLater(); }
158 inline bool IsOSMountainLionOrEarlier() { return !IsOSMavericksOrLater(); } 163 inline bool IsOSMountainLionOrEarlier() { return !IsOSMavericksOrLater(); }
159 inline bool IsOSMavericksOrEarlier() { return !IsOSYosemiteOrLater(); } 164 inline bool IsOSMavericksOrEarlier() { return !IsOSYosemiteOrLater(); }
165 inline bool IsOSYosemiteOrEarlier() { return !IsOSElCapitanOrLater(); }
160 166
161 // When the deployment target is set, the code produced cannot run on earlier 167 // When the deployment target is set, the code produced cannot run on earlier
162 // OS releases. That enables some of the IsOS* family to be implemented as 168 // OS releases. That enables some of the IsOS* family to be implemented as
163 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro 169 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro
164 // contains the value of the deployment target. 170 // contains the value of the deployment target.
165 171
166 #if defined(MAC_OS_X_VERSION_10_7) && \ 172 #if defined(MAC_OS_X_VERSION_10_7) && \
167 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 173 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
168 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7 174 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7
169 inline bool IsOSSnowLeopard() { return false; } 175 inline bool IsOSSnowLeopard() { return false; }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 #if defined(MAC_OS_X_VERSION_10_10) && \ 209 #if defined(MAC_OS_X_VERSION_10_10) && \
204 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10 210 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10
205 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_10 211 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_10
206 inline bool IsOSYosemiteOrLater() { return true; } 212 inline bool IsOSYosemiteOrLater() { return true; }
207 #endif 213 #endif
208 214
209 #if defined(MAC_OS_X_VERSION_10_10) && \ 215 #if defined(MAC_OS_X_VERSION_10_10) && \
210 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10 216 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10
211 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_10 217 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_10
212 inline bool IsOSYosemite() { return false; } 218 inline bool IsOSYosemite() { return false; }
213 inline bool IsOSLaterThanYosemite_DontCallThis() { return true; } 219 #endif
220
221 #if defined(MAC_OS_X_VERSION_10_11) && \
222 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11
223 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_11
224 inline bool IsOSElCapitanOrLater() { return true; }
225 #endif
226
227 #if defined(MAC_OS_X_VERSION_10_11) && \
228 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_11
229 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_11
230 inline bool IsOSElCapitan() { return false; }
231 inline bool IsOSLaterThanElCapitan_DontCallThis() { return true; }
214 #endif 232 #endif
215 233
216 // Retrieve the system's model identifier string from the IOKit registry: 234 // Retrieve the system's model identifier string from the IOKit registry:
217 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon 235 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon
218 // failure. 236 // failure.
219 BASE_EXPORT std::string GetModelIdentifier(); 237 BASE_EXPORT std::string GetModelIdentifier();
220 238
221 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1). 239 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1).
222 // If any error occurs, none of the input pointers are touched. 240 // If any error occurs, none of the input pointers are touched.
223 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, 241 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident,
224 std::string* type, 242 std::string* type,
225 int32* major, 243 int32* major,
226 int32* minor); 244 int32* minor);
227 245
228 } // namespace mac 246 } // namespace mac
229 } // namespace base 247 } // namespace base
230 248
231 #endif // BASE_MAC_MAC_UTIL_H_ 249 #endif // BASE_MAC_MAC_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/mac/mac_util.mm » ('j') | base/mac/mac_util_unittest.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698