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

Unified Diff: ui/base/resource/resource_bundle_mac.mm

Issue 6849030: Add support for multi resolution icons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comments Created 9 years, 8 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 | « ui/base/resource/resource_bundle_linux.cc ('k') | ui/base/resource/resource_bundle_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/resource/resource_bundle_mac.mm
diff --git a/ui/base/resource/resource_bundle_mac.mm b/ui/base/resource/resource_bundle_mac.mm
index 1a238a72c08d230a14f6863ce180027f2fd76086..0508177e090a0d7bddc14ff5b9bf36d8a016fb69 100644
--- a/ui/base/resource/resource_bundle_mac.mm
+++ b/ui/base/resource/resource_bundle_mac.mm
@@ -46,6 +46,11 @@ FilePath ResourceBundle::GetResourcesFilePath() {
}
// static
+FilePath ResourceBundle::GetLargeIconResourcesFilePath() {
+ return GetResourcesPakFilePath(@"theme_resources_large", nil);
+}
+
+// static
FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) {
NSString* mac_locale = base::SysUTF8ToNSString(app_locale);
@@ -89,6 +94,21 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) {
// Cache the converted image.
if (ns_image.get()) {
+ // Load a high resolution version of the icon if available.
+ if (large_icon_resources_data_) {
+ scoped_refptr<RefCountedStaticMemory> large_data(
+ LoadResourceBytes(large_icon_resources_data_, resource_id));
+ if (large_data.get()) {
+ scoped_nsobject<NSData> ns_large_data(
+ [[NSData alloc] initWithBytes:large_data->front()
+ length:large_data->size()]);
+ NSImageRep* image_rep =
+ [NSBitmapImageRep imageRepWithData:ns_large_data];
+ if (image_rep)
+ [ns_image addRepresentation:image_rep];
+ }
+ }
+
base::AutoLock lock(*lock_);
// Another thread raced the load and has already cached the image.
« no previous file with comments | « ui/base/resource/resource_bundle_linux.cc ('k') | ui/base/resource/resource_bundle_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698