| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 SCALE_FACTOR_100P); | 55 SCALE_FACTOR_100P); |
| 56 AddDataPack(GetResourcesPakFilePath(@"ui_resources_standard", nil), | 56 AddDataPack(GetResourcesPakFilePath(@"ui_resources_standard", nil), |
| 57 SCALE_FACTOR_100P); | 57 SCALE_FACTOR_100P); |
| 58 | 58 |
| 59 // On Windows and ChromeOS we load either the 1x resource or the 2x resource. | 59 // On Windows and ChromeOS we load either the 1x resource or the 2x resource. |
| 60 // On Mac we load both and let the UI framework decide which one to use. | 60 // On Mac we load both and let the UI framework decide which one to use. |
| 61 #if defined(ENABLE_HIDPI) | 61 #if defined(ENABLE_HIDPI) |
| 62 if (base::mac::IsOSLionOrLater()) { | 62 if (base::mac::IsOSLionOrLater()) { |
| 63 AddDataPack(GetResourcesPakFilePath(@"theme_resources_2x", nil), | 63 AddDataPack(GetResourcesPakFilePath(@"theme_resources_2x", nil), |
| 64 SCALE_FACTOR_200P); | 64 SCALE_FACTOR_200P); |
| 65 AddDataPack(GetResourcesPakFilePath(@"theme_resources_standard_2x", nil), | 65 AddDataPack(GetResourcesPakFilePath(@"ui_resources_2x", nil), |
| 66 SCALE_FACTOR_200P); | |
| 67 AddDataPack(GetResourcesPakFilePath(@"ui_resources_standard_2x", nil), | |
| 68 SCALE_FACTOR_200P); | 66 SCALE_FACTOR_200P); |
| 69 } | 67 } |
| 70 #endif | 68 #endif |
| 71 } | 69 } |
| 72 | 70 |
| 73 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { | 71 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { |
| 74 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); | 72 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); |
| 75 | 73 |
| 76 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value. | 74 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value. |
| 77 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" | 75 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 151 |
| 154 // Another thread raced the load and has already cached the image. | 152 // Another thread raced the load and has already cached the image. |
| 155 if (images_.count(resource_id)) | 153 if (images_.count(resource_id)) |
| 156 return images_[resource_id]; | 154 return images_[resource_id]; |
| 157 | 155 |
| 158 images_[resource_id] = image; | 156 images_[resource_id] = image; |
| 159 return images_[resource_id]; | 157 return images_[resource_id]; |
| 160 } | 158 } |
| 161 | 159 |
| 162 } // namespace ui | 160 } // namespace ui |
| OLD | NEW |