diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 21:27:30 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 21:27:30 +0000 |
commit | 4b77bf1d8d5023c6a9232ce41f24d5bfbb3aaff6 (patch) | |
tree | a0e17b93d9e59b3f9abe86b00154d7abbe0888d2 /base/mac_util.mm | |
parent | ba0ad5cfc951e80eea8b6a8c3ac2ddd02762b8df (diff) | |
download | chromium_src-4b77bf1d8d5023c6a9232ce41f24d5bfbb3aaff6.zip chromium_src-4b77bf1d8d5023c6a9232ce41f24d5bfbb3aaff6.tar.gz chromium_src-4b77bf1d8d5023c6a9232ce41f24d5bfbb3aaff6.tar.bz2 |
Use real creator code for Keychain items. Instead of hard-coding 'rimZ', use
the correct creator code for the application. This is 'rimZ' for branded
Google Chrome, and 'Cr24' for Chromium.
BUG=19000
TEST=No functional change in Google Chrome-branded builds
Review URL: http://codereview.chromium.org/164332
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23074 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac_util.mm')
-rw-r--r-- | base/mac_util.mm | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/base/mac_util.mm b/base/mac_util.mm index 5304b75..aebba8f 100644 --- a/base/mac_util.mm +++ b/base/mac_util.mm @@ -4,7 +4,6 @@ #include "base/mac_util.h" -#include <Carbon/Carbon.h> #import <Cocoa/Cocoa.h> #include "base/file_path.h" @@ -53,6 +52,35 @@ NSBundle* MainAppBundle() { return [NSBundle mainBundle]; } +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: " << file_path.value(); + + SetOverrideAppBundle(bundle); +} + +OSType CreatorCodeForCFBundleRef(CFBundleRef bundle) { + OSType creator; + CFBundleGetPackageInfo(bundle, NULL, &creator); + return creator; +} + +OSType CreatorCodeForApplication() { + CFBundleRef bundle = CFBundleGetMainBundle(); + if (!bundle) + return kUnknownType; + + return CreatorCodeForCFBundleRef(bundle); +} + FilePath GetUserLibraryPath() { NSArray* dirs = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); @@ -67,17 +95,5 @@ FilePath GetUserLibraryPath() { return FilePath(library_dir_path); } -void SetOverrideAppBundle(NSBundle* 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: " << file_path.value(); - - SetOverrideAppBundle(bundle); -} } // namespace mac_util |