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

Unified Diff: base/mac/foundation_util.mm

Issue 9187053: Transition to base/mac/bundle_locations.h step 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review comments. Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/mac/foundation_util.h ('k') | chrome/app/chrome_main_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
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);
« no previous file with comments | « base/mac/foundation_util.h ('k') | chrome/app/chrome_main_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698