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

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: Fixed touchui 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
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..eec123476a0d040e394c40d10c3dcda72a10e80c 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,18 @@ 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.
+ 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.

Powered by Google App Engine
This is Rietveld 408576698