diff options
author | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-10 20:36:14 +0000 |
---|---|---|
committer | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-10 20:36:14 +0000 |
commit | 62e7190b0445dcc6f80b63149a8763f59c3a7cf0 (patch) | |
tree | aa0786c3df079a0daec96045589a893792afceb0 /base/mac | |
parent | dc2befe454806f8d4e5f81d9f2a6f1feb2d9a270 (diff) | |
download | chromium_src-62e7190b0445dcc6f80b63149a8763f59c3a7cf0.zip chromium_src-62e7190b0445dcc6f80b63149a8763f59c3a7cf0.tar.gz chromium_src-62e7190b0445dcc6f80b63149a8763f59c3a7cf0.tar.bz2 |
Add support for ICU data in a data file.
- Mac Foundation utility for fetching a resource from the MainAppBundle.
- Bringing in newer ICU dep that has optional support for using the ICU data
file.
- If Mac is built using a ICU data file, directly map in the data so it will
work even in a sandboxed process.
**The build does not use this data file support at this time.**
This might help the Mac bots as it means each unittest that depends on base
will be ~10meg smaller, helping link and also helping with the copy of bits
from the builder to the tester.
If Mac ever support a Universal binary (32bit and 64bit) it will also probably
want to use this to avoid carrying two copies of the ICU data.
Review URL: http://codereview.chromium.org/6479021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74474 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac')
-rw-r--r-- | base/mac/foundation_util.h | 3 | ||||
-rw-r--r-- | base/mac/foundation_util.mm | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/base/mac/foundation_util.h b/base/mac/foundation_util.h index a94cf95..a7c525a 100644 --- a/base/mac/foundation_util.h +++ b/base/mac/foundation_util.h @@ -45,6 +45,9 @@ bool IsBackgroundOnlyProcess(); NSBundle* MainAppBundle(); FilePath MainAppBundlePath(); +// Returns the path to a resource within the MainAppBundle. +FilePath PathForMainAppBundleResource(CFStringRef resourceName); + // Set the bundle that MainAppBundle will return, overriding the default value // (Restore the default by calling SetOverrideAppBundle(nil)). void SetOverrideAppBundle(NSBundle* bundle); diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm index ad8a247..151d82f 100644 --- a/base/mac/foundation_util.mm +++ b/base/mac/foundation_util.mm @@ -80,6 +80,15 @@ FilePath MainAppBundlePath() { return FilePath([[bundle bundlePath] fileSystemRepresentation]); } +FilePath PathForMainAppBundleResource(CFStringRef resourceName) { + NSBundle* bundle = MainAppBundle(); + NSString* resourcePath = [bundle pathForResource:(NSString*)resourceName + ofType:nil]; + if (!resourcePath) + return FilePath(); + return FilePath([resourcePath fileSystemRepresentation]); +} + void SetOverrideAppBundle(NSBundle* bundle) { if (bundle != g_override_app_bundle) { [g_override_app_bundle release]; |