OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 main bundle or the override, used for code that needs | 46 // Returns the main bundle or the override, used for code that needs |
47 // to fetch resources from bundles, but work within a unittest where we | 47 // to fetch resources from bundles, but work within a unittest where we |
48 // aren't a bundle. | 48 // aren't a bundle. |
49 BASE_EXPORT NSBundle* MainAppBundle(); | 49 BASE_EXPORT NSBundle* MainAppBundle(); |
50 BASE_EXPORT FilePath MainAppBundlePath(); | 50 BASE_EXPORT FilePath MainAppBundlePath(); |
51 | 51 |
52 // Returns the path to a resource within the MainAppBundle. | 52 // Returns the path to a resource within the framework bundle. |
53 FilePath PathForMainAppBundleResource(CFStringRef resourceName); | 53 FilePath PathForFrameworkBundleResource(CFStringRef resourceName); |
54 | |
55 // Set the bundle that MainAppBundle will return, overriding the default value | |
56 // (Restore the default by calling SetOverrideAppBundle(nil)). | |
57 BASE_EXPORT void SetOverrideAppBundle(NSBundle* bundle); | |
58 BASE_EXPORT void SetOverrideAppBundlePath(const FilePath& file_path); | |
59 | 54 |
60 // Returns the creator code associated with the CFBundleRef at bundle. | 55 // Returns the creator code associated with the CFBundleRef at bundle. |
61 OSType CreatorCodeForCFBundleRef(CFBundleRef bundle); | 56 OSType CreatorCodeForCFBundleRef(CFBundleRef bundle); |
62 | 57 |
63 // Returns the creator code associated with this application, by calling | 58 // Returns the creator code associated with this application, by calling |
64 // CreatorCodeForCFBundleRef for the application's main bundle. If this | 59 // CreatorCodeForCFBundleRef for the application's main bundle. If this |
65 // information cannot be determined, returns kUnknownType ('????'). This | 60 // information cannot be determined, returns kUnknownType ('????'). This |
66 // does not respect the override app bundle because it's based on CFBundle | 61 // does not respect the override app bundle because it's based on CFBundle |
67 // instead of NSBundle, and because callers probably don't want the override | 62 // instead of NSBundle, and because callers probably don't want the override |
68 // app bundle's creator code anyway. | 63 // app bundle's creator code anyway. |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // by using the NSToCFCast methods above. | 302 // by using the NSToCFCast methods above. |
308 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); | 303 // e.g. LOG(INFO) << base::mac::NSToCFCast(@"foo"); |
309 // Operator << can not be overloaded for ObjectiveC types as the compiler | 304 // Operator << can not be overloaded for ObjectiveC types as the compiler |
310 // can not distinguish between overloads for id with overloads for void*. | 305 // can not distinguish between overloads for id with overloads for void*. |
311 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 306 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
312 const CFErrorRef err); | 307 const CFErrorRef err); |
313 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, | 308 BASE_EXPORT extern std::ostream& operator<<(std::ostream& o, |
314 const CFStringRef str); | 309 const CFStringRef str); |
315 | 310 |
316 #endif // BASE_MAC_FOUNDATION_UTIL_H_ | 311 #endif // BASE_MAC_FOUNDATION_UTIL_H_ |
OLD | NEW |