diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 14:52:20 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 14:52:20 +0000 |
commit | f82d69e9468b9c6250d093da8667816839d1c503 (patch) | |
tree | 81c868a0eba4a6d26df42aed2570e4630145cbe4 /base | |
parent | 7d9fb9604607d94b8606eac97b2d64f923923a08 (diff) | |
download | chromium_src-f82d69e9468b9c6250d093da8667816839d1c503.zip chromium_src-f82d69e9468b9c6250d093da8667816839d1c503.tar.gz chromium_src-f82d69e9468b9c6250d093da8667816839d1c503.tar.bz2 |
Mac: Make the nsimage_cache behave more like +[NSImage imageNamed:]
BUG=none
TEST=no visible change
Review URL: http://codereview.chromium.org/272032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28815 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/nsimage_cache_mac.mm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/base/nsimage_cache_mac.mm b/base/nsimage_cache_mac.mm index 7ca05be..1ced7a2 100644 --- a/base/nsimage_cache_mac.mm +++ b/base/nsimage_cache_mac.mm @@ -42,8 +42,14 @@ NSImage* ImageNamed(NSString* name) { if (path) { @try { result = [[[NSImage alloc] initWithContentsOfFile:path] autorelease]; - if (result) + if (result) { + // Auto-template images with names ending in "Template". + NSString* extensionlessName = [name stringByDeletingPathExtension]; + if ([extensionlessName hasSuffix:@"Template"]) + [result setTemplate:YES]; + [image_cache setObject:result forKey:name]; + } } @catch (id err) { DLOG(ERROR) << "Failed to load the image for name '" |