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

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

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 | « base/mac/call_with_eh_frame_unittest.mm ('k') | base/mac/mac_util.mm » ('j') | no next file with comments »
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 IsOSYosemiteOrLater(); 148 BASE_EXPORT bool IsOSYosemiteOrLater();
149 149
150 // El Capitan is Mac OS X 10.11, Darwin 15.
151 BASE_EXPORT bool IsOSElCapitan();
152 BASE_EXPORT bool IsOSElCapitanOrLater();
153
150 // This should be infrequently used. It only makes sense to use this to avoid 154 // 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, 155 // 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. 156 // unborn) OS releases, or to log when the OS is newer than any known version.
153 BASE_EXPORT bool IsOSLaterThanYosemite_DontCallThis(); 157 BASE_EXPORT bool IsOSLaterThanYosemite_DontCallThis();
154 158
155 // Inline functions that are redundant due to version ranges being mutually- 159 // Inline functions that are redundant due to version ranges being mutually-
156 // exclusive. 160 // exclusive.
157 inline bool IsOSLionOrEarlier() { return !IsOSMountainLionOrLater(); } 161 inline bool IsOSLionOrEarlier() { return !IsOSMountainLionOrLater(); }
158 inline bool IsOSMountainLionOrEarlier() { return !IsOSMavericksOrLater(); } 162 inline bool IsOSMountainLionOrEarlier() { return !IsOSMavericksOrLater(); }
159 inline bool IsOSMavericksOrEarlier() { return !IsOSYosemiteOrLater(); } 163 inline bool IsOSMavericksOrEarlier() { return !IsOSYosemiteOrLater(); }
164 inline bool IsOSYosemiteOrEarlier() {
165 return !IsOSElCapitanOrLater();
166 }
160 167
161 // When the deployment target is set, the code produced cannot run on earlier 168 // 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 169 // 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 170 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro
164 // contains the value of the deployment target. 171 // contains the value of the deployment target.
165 172
166 #if defined(MAC_OS_X_VERSION_10_7) && \ 173 #if defined(MAC_OS_X_VERSION_10_7) && \
167 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 174 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
168 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7 175 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7
169 inline bool IsOSSnowLeopard() { return false; } 176 inline bool IsOSSnowLeopard() { return false; }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 inline bool IsOSYosemiteOrLater() { return true; } 213 inline bool IsOSYosemiteOrLater() { return true; }
207 #endif 214 #endif
208 215
209 #if defined(MAC_OS_X_VERSION_10_10) && \ 216 #if defined(MAC_OS_X_VERSION_10_10) && \
210 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10 217 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10
211 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_10 218 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_10
212 inline bool IsOSYosemite() { return false; } 219 inline bool IsOSYosemite() { return false; }
213 inline bool IsOSLaterThanYosemite_DontCallThis() { return true; } 220 inline bool IsOSLaterThanYosemite_DontCallThis() { return true; }
214 #endif 221 #endif
215 222
223 #if defined(MAC_OS_X_VERSION_10_11) && \
224 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11
225 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_11
226 inline bool IsOSElCapitanOrLater() {
227 return true;
228 }
229 #endif
230
231 #if defined(MAC_OS_X_VERSION_10_11) && \
232 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_11
233 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_11
234 inline bool IsOSElCapitan() {
235 return false;
236 }
237 #endif
238
216 // Retrieve the system's model identifier string from the IOKit registry: 239 // Retrieve the system's model identifier string from the IOKit registry:
217 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon 240 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon
218 // failure. 241 // failure.
219 BASE_EXPORT std::string GetModelIdentifier(); 242 BASE_EXPORT std::string GetModelIdentifier();
220 243
221 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1). 244 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1).
222 // If any error occurs, none of the input pointers are touched. 245 // If any error occurs, none of the input pointers are touched.
223 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, 246 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident,
224 std::string* type, 247 std::string* type,
225 int32* major, 248 int32* major,
226 int32* minor); 249 int32* minor);
227 250
228 } // namespace mac 251 } // namespace mac
229 } // namespace base 252 } // namespace base
230 253
231 #endif // BASE_MAC_MAC_UTIL_H_ 254 #endif // BASE_MAC_MAC_UTIL_H_
OLDNEW
« no previous file with comments | « base/mac/call_with_eh_frame_unittest.mm ('k') | base/mac/mac_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698