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_FOUNDATION_UTIL_H_ | 5 #ifndef BASE_MAC_FOUNDATION_UTIL_H_ |
6 #define BASE_MAC_FOUNDATION_UTIL_H_ | 6 #define BASE_MAC_FOUNDATION_UTIL_H_ |
7 | 7 |
8 #include <CoreFoundation/CoreFoundation.h> | 8 #include <CoreFoundation/CoreFoundation.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 typedef CR_FORWARD_ENUM(unsigned long, NSSearchPathDirectory); | 48 typedef CR_FORWARD_ENUM(unsigned long, NSSearchPathDirectory); |
49 typedef unsigned long NSSearchPathDomainMask; | 49 typedef unsigned long NSSearchPathDomainMask; |
50 #else | 50 #else |
51 typedef CR_FORWARD_ENUM(unsigned int, NSSearchPathDirectory); | 51 typedef CR_FORWARD_ENUM(unsigned int, NSSearchPathDirectory); |
52 typedef unsigned int NSSearchPathDomainMask; | 52 typedef unsigned int NSSearchPathDomainMask; |
53 #endif | 53 #endif |
54 | 54 |
55 typedef struct OpaqueSecTrustRef* SecACLRef; | 55 typedef struct OpaqueSecTrustRef* SecACLRef; |
56 typedef struct OpaqueSecTrustedApplicationRef* SecTrustedApplicationRef; | 56 typedef struct OpaqueSecTrustedApplicationRef* SecTrustedApplicationRef; |
57 | 57 |
| 58 #if defined(OS_IOS) |
| 59 typedef struct CF_BRIDGED_TYPE(id) __SecPolicy* SecPolicyRef; |
| 60 #else |
| 61 typedef struct OpaqueSecPolicyRef* SecPolicyRef; |
| 62 #endif |
| 63 |
58 namespace base { | 64 namespace base { |
59 | 65 |
60 class FilePath; | 66 class FilePath; |
61 | 67 |
62 namespace mac { | 68 namespace mac { |
63 | 69 |
64 // Returns true if the application is running from a bundle | 70 // Returns true if the application is running from a bundle |
65 BASE_EXPORT bool AmIBundled(); | 71 BASE_EXPORT bool AmIBundled(); |
66 BASE_EXPORT void SetOverrideAmIBundled(bool value); | 72 BASE_EXPORT void SetOverrideAmIBundled(bool value); |
67 | 73 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 TYPE_NAME_FOR_CF_TYPE_DECL(CFSet); | 140 TYPE_NAME_FOR_CF_TYPE_DECL(CFSet); |
135 TYPE_NAME_FOR_CF_TYPE_DECL(CFString); | 141 TYPE_NAME_FOR_CF_TYPE_DECL(CFString); |
136 TYPE_NAME_FOR_CF_TYPE_DECL(CFURL); | 142 TYPE_NAME_FOR_CF_TYPE_DECL(CFURL); |
137 TYPE_NAME_FOR_CF_TYPE_DECL(CFUUID); | 143 TYPE_NAME_FOR_CF_TYPE_DECL(CFUUID); |
138 | 144 |
139 TYPE_NAME_FOR_CF_TYPE_DECL(CGColor); | 145 TYPE_NAME_FOR_CF_TYPE_DECL(CGColor); |
140 | 146 |
141 TYPE_NAME_FOR_CF_TYPE_DECL(CTFont); | 147 TYPE_NAME_FOR_CF_TYPE_DECL(CTFont); |
142 TYPE_NAME_FOR_CF_TYPE_DECL(CTRun); | 148 TYPE_NAME_FOR_CF_TYPE_DECL(CTRun); |
143 | 149 |
| 150 TYPE_NAME_FOR_CF_TYPE_DECL(SecPolicy); |
| 151 |
144 #undef TYPE_NAME_FOR_CF_TYPE_DECL | 152 #undef TYPE_NAME_FOR_CF_TYPE_DECL |
145 | 153 |
146 // Retain/release calls for memory management in C++. | 154 // Retain/release calls for memory management in C++. |
147 BASE_EXPORT void NSObjectRetain(void* obj); | 155 BASE_EXPORT void NSObjectRetain(void* obj); |
148 BASE_EXPORT void NSObjectRelease(void* obj); | 156 BASE_EXPORT void NSObjectRelease(void* obj); |
149 | 157 |
150 // CFTypeRefToNSObjectAutorelease transfers ownership of a Core Foundation | 158 // CFTypeRefToNSObjectAutorelease transfers ownership of a Core Foundation |
151 // object (one derived from CFTypeRef) to the Foundation memory management | 159 // object (one derived from CFTypeRef) to the Foundation memory management |
152 // system. In a traditional managed-memory environment, cf_object is | 160 // system. In a traditional managed-memory environment, cf_object is |
153 // autoreleased and returned as an NSObject. In a garbage-collected | 161 // autoreleased and returned as an NSObject. In a garbage-collected |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 CF_CAST_DECL(CFURL); | 302 CF_CAST_DECL(CFURL); |
295 CF_CAST_DECL(CFUUID); | 303 CF_CAST_DECL(CFUUID); |
296 | 304 |
297 CF_CAST_DECL(CGColor); | 305 CF_CAST_DECL(CGColor); |
298 | 306 |
299 CF_CAST_DECL(CTFont); | 307 CF_CAST_DECL(CTFont); |
300 CF_CAST_DECL(CTFontDescriptor); | 308 CF_CAST_DECL(CTFontDescriptor); |
301 CF_CAST_DECL(CTRun); | 309 CF_CAST_DECL(CTRun); |
302 | 310 |
303 CF_CAST_DECL(SecACL); | 311 CF_CAST_DECL(SecACL); |
| 312 CF_CAST_DECL(SecPolicy); |
304 CF_CAST_DECL(SecTrustedApplication); | 313 CF_CAST_DECL(SecTrustedApplication); |
305 | 314 |
306 #undef CF_CAST_DECL | 315 #undef CF_CAST_DECL |
307 | 316 |
308 #if defined(__OBJC__) | 317 #if defined(__OBJC__) |
309 | 318 |
310 // ObjCCast<>() and ObjCCastStrict<>() cast a basic id to a more | 319 // ObjCCast<>() and ObjCCastStrict<>() cast a basic id to a more |
311 // specific (NSObject-derived) type. The compatibility of the passed | 320 // specific (NSObject-derived) type. The compatibility of the passed |
312 // object is found by checking if it's a kind of the requested type | 321 // object is found by checking if it's a kind of the requested type |
313 // identifier. If the supplied object is not compatible with the | 322 // identifier. If the supplied object is not compatible with the |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 // by using the NSToCFCast methods above. | 398 // by using the NSToCFCast methods above. |
390 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); | 399 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); |
391 // Operator << can not be overloaded for ObjectiveC types as the compiler | 400 // Operator << can not be overloaded for ObjectiveC types as the compiler |
392 // can not distinguish between overloads for id with overloads for void*. | 401 // can not distinguish between overloads for id with overloads for void*. |
393 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 402 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
394 const CFErrorRef err); | 403 const CFErrorRef err); |
395 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 404 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
396 const CFStringRef str); | 405 const CFStringRef str); |
397 | 406 |
398 #endif // BASE_MAC_FOUNDATION_UTIL_H_ | 407 #endif // BASE_MAC_FOUNDATION_UTIL_H_ |
OLD | NEW |