| 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 26 matching lines...) Expand all Loading... |
| 37 ofType:@"pak"]; | 37 ofType:@"pak"]; |
| 38 } | 38 } |
| 39 if (!resource_path) | 39 if (!resource_path) |
| 40 return FilePath(); | 40 return FilePath(); |
| 41 return FilePath([resource_path fileSystemRepresentation]); | 41 return FilePath([resource_path fileSystemRepresentation]); |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // namespace | 44 } // namespace |
| 45 | 45 |
| 46 void ResourceBundle::LoadCommonResources() { | 46 void ResourceBundle::LoadCommonResources() { |
| 47 AddDataPack(GetResourcesPakFilePath(@"chrome", nil)); | 47 AddDataPack(GetResourcesPakFilePath(@"chrome", nil), |
| 48 AddDataPack(GetResourcesPakFilePath(@"theme_resources_standard", nil)); | 48 ResourceHandle::kScaleFactor100x); |
| 49 AddDataPack(GetResourcesPakFilePath(@"ui_resources_standard", nil)); | 49 AddDataPack(GetResourcesPakFilePath(@"theme_resources_standard", nil), |
| 50 ResourceHandle::kScaleFactor100x); |
| 51 AddDataPack(GetResourcesPakFilePath(@"ui_resources_standard", nil), |
| 52 ResourceHandle::kScaleFactor100x); |
| 50 | 53 |
| 51 // On Windows and ChromeOS we load either the 1x resource or the 2x resource. | 54 // On Windows and ChromeOS we load either the 1x resource or the 2x resource. |
| 52 // On Mac we load both and let the UI framework decide which one to use. | 55 // On Mac we load both and let the UI framework decide which one to use. |
| 53 #if defined(ENABLE_HIDPI) | 56 #if defined(ENABLE_HIDPI) |
| 54 if (base::mac::IsOSLionOrLater()) { | 57 if (base::mac::IsOSLionOrLater()) { |
| 55 AddDataPack(GetResourcesPakFilePath(@"theme_resources_2x", nil)); | 58 AddDataPack(GetResourcesPakFilePath(@"theme_resources_2x", nil), |
| 56 AddDataPack(GetResourcesPakFilePath(@"theme_resources_standard_2x", nil)); | 59 ResourceHandle::kScaleFactor200x); |
| 57 AddDataPack(GetResourcesPakFilePath(@"ui_resources_standard_2x", nil)); | 60 AddDataPack(GetResourcesPakFilePath(@"theme_resources_standard_2x", nil), |
| 61 ResourceHandle::kScaleFactor200x); |
| 62 AddDataPack(GetResourcesPakFilePath(@"ui_resources_standard_2x", nil), |
| 63 ResourceHandle::kScaleFactor200x); |
| 58 } | 64 } |
| 59 #endif | 65 #endif |
| 60 } | 66 } |
| 61 | 67 |
| 62 // static | 68 // static |
| 63 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { | 69 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { |
| 64 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); | 70 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); |
| 65 | 71 |
| 66 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value. | 72 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value. |
| 67 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" | 73 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 if (images_.count(resource_id)) { | 130 if (images_.count(resource_id)) { |
| 125 return *images_[resource_id]; | 131 return *images_[resource_id]; |
| 126 } | 132 } |
| 127 | 133 |
| 128 gfx::Image* image = new gfx::Image(ns_image.release()); | 134 gfx::Image* image = new gfx::Image(ns_image.release()); |
| 129 images_[resource_id] = image; | 135 images_[resource_id] = image; |
| 130 return *image; | 136 return *image; |
| 131 } | 137 } |
| 132 | 138 |
| 133 } // namespace ui | 139 } // namespace ui |
| OLD | NEW |