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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 return FilePath([resource_path fileSystemRepresentation]); | 46 return FilePath([resource_path fileSystemRepresentation]); |
47 } | 47 } |
48 | 48 |
49 } // namespace | 49 } // namespace |
50 | 50 |
51 void ResourceBundle::LoadCommonResources() { | 51 void ResourceBundle::LoadCommonResources() { |
52 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome", nil), | 52 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome", nil), |
53 SCALE_FACTOR_100P); | 53 SCALE_FACTOR_100P); |
54 AddDataPackFromPath(GetResourcesPakFilePath(@"theme_resources_100_percent", | 54 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_100_percent", |
55 nil), SCALE_FACTOR_100P); | |
56 AddDataPackFromPath(GetResourcesPakFilePath(@"ui_resources_100_percent", | |
57 nil), SCALE_FACTOR_100P); | 55 nil), SCALE_FACTOR_100P); |
58 AddDataPackFromPath(GetResourcesPakFilePath(@"webkit_resources_100_percent", | 56 AddDataPackFromPath(GetResourcesPakFilePath(@"webkit_resources_100_percent", |
59 nil), SCALE_FACTOR_100P); | 57 nil), SCALE_FACTOR_100P); |
60 | 58 |
61 // 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. |
62 // 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. |
63 #if defined(ENABLE_HIDPI) | 61 #if defined(ENABLE_HIDPI) |
64 if (base::mac::IsOSLionOrLater()) { | 62 if (base::mac::IsOSLionOrLater()) { |
65 AddDataPackFromPath(GetResourcesPakFilePath(@"theme_resources_200_percent", | 63 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_200_percent", |
66 nil), SCALE_FACTOR_200P); | |
67 AddDataPackFromPath(GetResourcesPakFilePath(@"ui_resources_200_percent", | |
68 nil), SCALE_FACTOR_200P); | 64 nil), SCALE_FACTOR_200P); |
69 AddDataPackFromPath(GetResourcesPakFilePath(@"webkit_resources_200_percent", | 65 AddDataPackFromPath(GetResourcesPakFilePath(@"webkit_resources_200_percent", |
70 nil), SCALE_FACTOR_200P); | 66 nil), SCALE_FACTOR_200P); |
71 } | 67 } |
72 #endif | 68 #endif |
73 } | 69 } |
74 | 70 |
75 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, | 71 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, |
76 bool test_file_exists) { | 72 bool test_file_exists) { |
77 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); | 73 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 152 |
157 // Another thread raced the load and has already cached the image. | 153 // Another thread raced the load and has already cached the image. |
158 if (images_.count(resource_id)) | 154 if (images_.count(resource_id)) |
159 return images_[resource_id]; | 155 return images_[resource_id]; |
160 | 156 |
161 images_[resource_id] = image; | 157 images_[resource_id] = image; |
162 return images_[resource_id]; | 158 return images_[resource_id]; |
163 } | 159 } |
164 | 160 |
165 } // namespace ui | 161 } // namespace ui |
OLD | NEW |