| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/resource/resource_bundle.h" | 5 #include "ui/base/resource/resource_bundle.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" | 51 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" |
| 52 withString:@"_"]; | 52 withString:@"_"]; |
| 53 | 53 |
| 54 // On disk, the "en_US" resources are just "en" (http://crbug.com/25578). | 54 // On disk, the "en_US" resources are just "en" (http://crbug.com/25578). |
| 55 if ([mac_locale isEqual:@"en_US"]) | 55 if ([mac_locale isEqual:@"en_US"]) |
| 56 mac_locale = @"en"; | 56 mac_locale = @"en"; |
| 57 | 57 |
| 58 return GetResourcesPakFilePath(@"locale", mac_locale); | 58 return GetResourcesPakFilePath(@"locale", mac_locale); |
| 59 } | 59 } |
| 60 | 60 |
| 61 NSImage* ResourceBundle::GetNSImageNamed(int resource_id) { | 61 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { |
| 62 // Currently this doesn't make a cache holding these as NSImages because | 62 // Currently this just returns the Skia-backed image, which will convert to |
| 63 // GetBitmapNamed has a cache, and we don't want to double cache. | 63 // NSImage and cache that result when necessary. |
| 64 SkBitmap* bitmap = GetBitmapNamed(resource_id); | 64 // TODO(rsesek): Load the raw bytes directly into an NSImage instead. |
| 65 if (!bitmap) | 65 return GetImageNamed(resource_id); |
| 66 return nil; | |
| 67 | |
| 68 NSImage* nsimage = gfx::SkBitmapToNSImage(*bitmap); | |
| 69 return nsimage; | |
| 70 } | 66 } |
| 71 | 67 |
| 72 } // namespace ui | 68 } // namespace ui |
| OLD | NEW |