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

Unified Diff: base/mac_util.mm

Issue 164332: Use real creator code for Keychain items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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_util.h ('k') | chrome/browser/importer/importer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac_util.mm
===================================================================
--- base/mac_util.mm (revision 23061)
+++ base/mac_util.mm (working copy)
@@ -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 @@
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 @@
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
« no previous file with comments | « base/mac_util.h ('k') | chrome/browser/importer/importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698