Chromium Code Reviews| Index: base/mac/foundation_util.mm |
| diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm |
| index f1d277a9b036d11d6f645da3ba928bcda78d969a..1aa5c09700a92e9c9a3c8f20c47d8c8117f8fa02 100644 |
| --- a/base/mac/foundation_util.mm |
| +++ b/base/mac/foundation_util.mm |
| @@ -9,6 +9,7 @@ |
| #include "base/file_path.h" |
| #include "base/logging.h" |
| +#include "base/mac/bundle_locations.h" |
| #include "base/sys_string_conversions.h" |
| namespace base { |
| @@ -61,29 +62,22 @@ void SetOverrideAmIBundled(bool value) { |
| bool IsBackgroundOnlyProcess() { |
| // This function really does want to examine NSBundle's idea of the main |
| - // bundle dictionary, and not the overriden MainAppBundle. It needs to look |
| - // at the actual running .app's Info.plist to access its LSUIElement |
| - // property. |
| - NSDictionary* info_dictionary = [[NSBundle mainBundle] infoDictionary]; |
| + // bundle dictionary. It needs to look at the actual running .app's |
| + // Info.plist to access its LSUIElement property. |
| + NSDictionary* info_dictionary = [base::mac::MainBundle() infoDictionary]; |
| return [[info_dictionary objectForKey:@"LSUIElement"] boolValue] != NO; |
| } |
| -// No threading worries since NSBundle isn't thread safe. |
| -static NSBundle* g_override_app_bundle = nil; |
| - |
| NSBundle* MainAppBundle() { |
| - if (g_override_app_bundle) |
| - return g_override_app_bundle; |
| - return [NSBundle mainBundle]; |
| + return base::mac::FrameworkBundle(); |
|
Avi (use Gerrit)
2012/01/12 15:29:44
If this is a call-through, and the bundle_location
|
| } |
| FilePath MainAppBundlePath() { |
| - NSBundle* bundle = MainAppBundle(); |
| - return FilePath([[bundle bundlePath] fileSystemRepresentation]); |
| + return base::mac::FrameworkBundlePath(); |
| } |
| -FilePath PathForMainAppBundleResource(CFStringRef resourceName) { |
| - NSBundle* bundle = MainAppBundle(); |
| +FilePath PathForFrameworkBundleResource(CFStringRef resourceName) { |
| + NSBundle* bundle = base::mac::FrameworkBundle(); |
| NSString* resourcePath = [bundle pathForResource:(NSString*)resourceName |
| ofType:nil]; |
| if (!resourcePath) |
| @@ -91,21 +85,6 @@ FilePath PathForMainAppBundleResource(CFStringRef resourceName) { |
| return FilePath([resourcePath fileSystemRepresentation]); |
| } |
| -void SetOverrideAppBundle(NSBundle* bundle) { |
| - if (bundle != g_override_app_bundle) { |
| - [g_override_app_bundle release]; |
| - g_override_app_bundle = [bundle retain]; |
| - } |
| -} |
| - |
| -void SetOverrideAppBundlePath(const FilePath& file_path) { |
| - NSString* path = base::SysUTF8ToNSString(file_path.value()); |
| - NSBundle* bundle = [NSBundle bundleWithPath:path]; |
| - DCHECK(bundle) << "Failed to load the bundle at " << file_path.value(); |
| - |
| - SetOverrideAppBundle(bundle); |
| -} |
| - |
| OSType CreatorCodeForCFBundleRef(CFBundleRef bundle) { |
| OSType creator = kUnknownType; |
| CFBundleGetPackageInfo(bundle, NULL, &creator); |