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_util.h" | 10 #include "base/file_util.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 return base::FilePath([resource_path fileSystemRepresentation]); | 46 return base::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_100_percent", | 52 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_100_percent", |
53 nil), SCALE_FACTOR_100P); | 53 nil), SCALE_FACTOR_100P); |
54 AddDataPackFromPath(GetResourcesPakFilePath(@"content_resources_100_percent", | |
55 nil), SCALE_FACTOR_100P); | |
56 | 54 |
57 // On Mac we load 1x and 2x resources and we let the UI framework decide | 55 // On Mac we load 1x and 2x resources and we let the UI framework decide |
58 // which one to use. | 56 // which one to use. |
59 if (IsScaleFactorSupported(SCALE_FACTOR_200P)) { | 57 if (IsScaleFactorSupported(SCALE_FACTOR_200P)) { |
60 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_200_percent", nil), | 58 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_200_percent", nil), |
61 SCALE_FACTOR_200P); | 59 SCALE_FACTOR_200P); |
62 AddDataPackFromPath( | |
63 GetResourcesPakFilePath(@"content_resources_200_percent", nil), | |
64 SCALE_FACTOR_200P); | |
65 } | 60 } |
66 } | 61 } |
67 | 62 |
68 base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, | 63 base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, |
69 bool test_file_exists) { | 64 bool test_file_exists) { |
70 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); | 65 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); |
71 | 66 |
72 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value. | 67 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value. |
73 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" | 68 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" |
74 withString:@"_"]; | 69 withString:@"_"]; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 144 |
150 // Another thread raced the load and has already cached the image. | 145 // Another thread raced the load and has already cached the image. |
151 if (images_.count(resource_id)) | 146 if (images_.count(resource_id)) |
152 return images_[resource_id]; | 147 return images_[resource_id]; |
153 | 148 |
154 images_[resource_id] = image; | 149 images_[resource_id] = image; |
155 return images_[resource_id]; | 150 return images_[resource_id]; |
156 } | 151 } |
157 | 152 |
158 } // namespace ui | 153 } // namespace ui |
OLD | NEW |