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

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

Issue 9706001: [Mac] Add the OS version check functions for 10.8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 #pragma once 7 #pragma once
8 8
9 #include <AvailabilityMacros.h> 9 #include <AvailabilityMacros.h>
10 #include <Carbon/Carbon.h> 10 #include <Carbon/Carbon.h>
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 BASE_EXPORT bool IsOSLeopard(); 131 BASE_EXPORT bool IsOSLeopard();
132 BASE_EXPORT bool IsOSLeopardOrEarlier(); 132 BASE_EXPORT bool IsOSLeopardOrEarlier();
133 133
134 // Snow Leopard is Mac OS X 10.6, Darwin 10. 134 // Snow Leopard is Mac OS X 10.6, Darwin 10.
135 BASE_EXPORT bool IsOSSnowLeopard(); 135 BASE_EXPORT bool IsOSSnowLeopard();
136 BASE_EXPORT bool IsOSSnowLeopardOrEarlier(); 136 BASE_EXPORT bool IsOSSnowLeopardOrEarlier();
137 BASE_EXPORT bool IsOSSnowLeopardOrLater(); 137 BASE_EXPORT bool IsOSSnowLeopardOrLater();
138 138
139 // Lion is Mac OS X 10.7, Darwin 11. 139 // Lion is Mac OS X 10.7, Darwin 11.
140 BASE_EXPORT bool IsOSLion(); 140 BASE_EXPORT bool IsOSLion();
141 BASE_EXPORT bool IsOSLionOrEarlier();
141 BASE_EXPORT bool IsOSLionOrLater(); 142 BASE_EXPORT bool IsOSLionOrLater();
142 143
144 // Mountain Lion is Mac OS X 10.8, Darwin 12.
145 BASE_EXPORT bool IsOSMountainLion();
146 BASE_EXPORT bool IsOSMountainLionOrEarlier();
Mark Mentovai 2012/03/14 03:30:38 This should not be present. Instead, provide IsOSL
Robert Sesek 2012/03/14 14:46:22 I think it should be present. It will just have to
147 BASE_EXPORT bool IsOSMountainLionOrLater();
148
143 // This should be infrequently used. It only makes sense to use this to avoid 149 // 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, 150 // codepaths that are very likely to break on future (unreleased, untested,
145 // unborn) OS releases. 151 // unborn) OS releases.
146 BASE_EXPORT bool IsOSLaterThanLion(); 152 BASE_EXPORT bool IsOSLaterThanLion();
147 153
148 // When the deployment target is set, the code produced cannot run on earlier 154 // When the deployment target is set, the code produced cannot run on earlier
149 // OS releases. That enables some of the IsOS* family to be implemented as 155 // OS releases. That enables some of the IsOS* family to be implemented as
150 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro 156 // constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro
151 // contains the value of the deployment target. 157 // contains the value of the deployment target.
152 158
(...skipping 10 matching lines...) Expand all
163 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7 169 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7
164 inline bool IsOSSnowLeopard() { return false; } 170 inline bool IsOSSnowLeopard() { return false; }
165 inline bool IsOSSnowLeopardOrEarlier() { return false; } 171 inline bool IsOSSnowLeopardOrEarlier() { return false; }
166 inline bool IsOSLionOrLater() { return true; } 172 inline bool IsOSLionOrLater() { return true; }
167 #endif 173 #endif
168 174
169 #if defined(MAC_OS_X_VERSION_10_7) && \ 175 #if defined(MAC_OS_X_VERSION_10_7) && \
170 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_7 176 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_7
171 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7 177 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7
172 inline bool IsOSLion() { return false; } 178 inline bool IsOSLion() { return false; }
179 inline bool IsOSLionOrEarlier() { return false; }
173 inline bool IsOSLaterThanLion() { return true; } 180 inline bool IsOSLaterThanLion() { return true; }
174 #endif 181 #endif
175 182
183 #if defined(MAC_OS_X_VERSION_10_8) && \
184 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8
185 #define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_8
186 inline bool IsOSMountainLionOrLater() { return true; }
187 #endif
188
189 #if defined(MAC_OS_X_VERSION_10_8) && \
190 MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8
191 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8
192 inline bool IsOSMountainLion() { return false; }
193 inline bool IsOSMountainLionOrEarlier() { return false; }
194 #endif
195
176 // Retrieve the system's model identifier string from the IOKit registry: 196 // Retrieve the system's model identifier string from the IOKit registry:
177 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon 197 // for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon
178 // failure. 198 // failure.
179 BASE_EXPORT std::string GetModelIdentifier(); 199 BASE_EXPORT std::string GetModelIdentifier();
180 200
181 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1). 201 // Parse a model identifier string; for example, into ("MacBookPro", 6, 1).
182 // If any error occurs, none of the input pointers are touched. 202 // If any error occurs, none of the input pointers are touched.
183 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident, 203 BASE_EXPORT bool ParseModelIdentifier(const std::string& ident,
184 std::string* type, 204 std::string* type,
185 int32* major, 205 int32* major,
186 int32* minor); 206 int32* minor);
187 207
188 } // namespace mac 208 } // namespace mac
189 } // namespace base 209 } // namespace base
190 210
191 #endif // BASE_MAC_MAC_UTIL_H_ 211 #endif // BASE_MAC_MAC_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/mac/mac_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698