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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <CoreFoundation/CoreFoundation.h> | 9 #include <CoreFoundation/CoreFoundation.h> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 namespace mac { | 37 namespace mac { |
38 | 38 |
39 // Returns true if the application is running from a bundle | 39 // Returns true if the application is running from a bundle |
40 BASE_EXPORT bool AmIBundled(); | 40 BASE_EXPORT bool AmIBundled(); |
41 BASE_EXPORT void SetOverrideAmIBundled(bool value); | 41 BASE_EXPORT void SetOverrideAmIBundled(bool value); |
42 | 42 |
43 // Returns true if this process is marked as a "Background only process". | 43 // Returns true if this process is marked as a "Background only process". |
44 BASE_EXPORT bool IsBackgroundOnlyProcess(); | 44 BASE_EXPORT bool IsBackgroundOnlyProcess(); |
45 | 45 |
46 // Returns the path to a resource within the framework bundle. | 46 // Returns the path to a resource within the framework bundle. |
47 FilePath PathForFrameworkBundleResource(CFStringRef resourceName); | 47 BASE_EXPORT FilePath PathForFrameworkBundleResource(CFStringRef resourceName); |
48 | 48 |
49 // Returns the creator code associated with the CFBundleRef at bundle. | 49 // Returns the creator code associated with the CFBundleRef at bundle. |
50 OSType CreatorCodeForCFBundleRef(CFBundleRef bundle); | 50 OSType CreatorCodeForCFBundleRef(CFBundleRef bundle); |
51 | 51 |
52 // Returns the creator code associated with this application, by calling | 52 // Returns the creator code associated with this application, by calling |
53 // CreatorCodeForCFBundleRef for the application's main bundle. If this | 53 // CreatorCodeForCFBundleRef for the application's main bundle. If this |
54 // information cannot be determined, returns kUnknownType ('????'). This | 54 // information cannot be determined, returns kUnknownType ('????'). This |
55 // does not respect the override app bundle because it's based on CFBundle | 55 // does not respect the override app bundle because it's based on CFBundle |
56 // instead of NSBundle, and because callers probably don't want the override | 56 // instead of NSBundle, and because callers probably don't want the override |
57 // app bundle's creator code anyway. | 57 // app bundle's creator code anyway. |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 std::string expected_type = TypeNameForCFType(value_specific); | 304 std::string expected_type = TypeNameForCFType(value_specific); |
305 DLOG(WARNING) << GetValueFromDictionaryErrorMessage(key, | 305 DLOG(WARNING) << GetValueFromDictionaryErrorMessage(key, |
306 expected_type, | 306 expected_type, |
307 value); | 307 value); |
308 } | 308 } |
309 | 309 |
310 return value_specific; | 310 return value_specific; |
311 } | 311 } |
312 | 312 |
313 // Converts |path| to an autoreleased NSString. Returns nil if |path| is empty. | 313 // Converts |path| to an autoreleased NSString. Returns nil if |path| is empty. |
314 NSString* FilePathToNSString(const FilePath& path); | 314 BASE_EXPORT NSString* FilePathToNSString(const FilePath& path); |
315 | 315 |
316 // Converts |str| to a FilePath. Returns an empty path if |str| is nil. | 316 // Converts |str| to a FilePath. Returns an empty path if |str| is nil. |
317 FilePath NSStringToFilePath(NSString* str); | 317 BASE_EXPORT FilePath NSStringToFilePath(NSString* str); |
318 | 318 |
319 } // namespace mac | 319 } // namespace mac |
320 } // namespace base | 320 } // namespace base |
321 | 321 |
322 // Stream operations for CFTypes. They can be used with NSTypes as well | 322 // Stream operations for CFTypes. They can be used with NSTypes as well |
323 // by using the NSToCFCast methods above. | 323 // by using the NSToCFCast methods above. |
324 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); | 324 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); |
325 // Operator << can not be overloaded for ObjectiveC types as the compiler | 325 // Operator << can not be overloaded for ObjectiveC types as the compiler |
326 // can not distinguish between overloads for id with overloads for void*. | 326 // can not distinguish between overloads for id with overloads for void*. |
327 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 327 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
328 const CFErrorRef err); | 328 const CFErrorRef err); |
329 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 329 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
330 const CFStringRef str); | 330 const CFStringRef str); |
331 | 331 |
332 #endif // BASE_MAC_FOUNDATION_UTIL_H_ | 332 #endif // BASE_MAC_FOUNDATION_UTIL_H_ |
OLD | NEW |