OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 if (IsScaleFactorSupported(SCALE_FACTOR_100P)) { | 47 if (IsScaleFactorSupported(SCALE_FACTOR_100P)) { |
48 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_100_percent", nil), | 48 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_100_percent", nil), |
49 SCALE_FACTOR_100P); | 49 SCALE_FACTOR_100P); |
50 } | 50 } |
51 | 51 |
52 if (IsScaleFactorSupported(SCALE_FACTOR_200P)) { | 52 if (IsScaleFactorSupported(SCALE_FACTOR_200P)) { |
53 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_200_percent", nil), | 53 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_200_percent", nil), |
54 SCALE_FACTOR_200P); | 54 SCALE_FACTOR_200P); |
55 } | 55 } |
56 | 56 |
57 // TODO(rohitrao): Add a chrome_300_percent file and load it here. For now, | |
58 // we are simply falling back to the 200P resources. http://crbug.com/413300. | |
59 if (IsScaleFactorSupported(SCALE_FACTOR_300P)) { | 57 if (IsScaleFactorSupported(SCALE_FACTOR_300P)) { |
60 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_200_percent", nil), | 58 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_300_percent", nil), |
61 SCALE_FACTOR_200P); | 59 SCALE_FACTOR_300P); |
62 } | 60 } |
63 } | 61 } |
64 | 62 |
65 base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, | 63 base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, |
66 bool test_file_exists) { | 64 bool test_file_exists) { |
67 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); | 65 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); |
68 | 66 |
69 // iOS uses "_" instead of "-", so swap to get a iOS-style value. | 67 // iOS uses "_" instead of "-", so swap to get a iOS-style value. |
70 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" | 68 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" |
71 withString:@"_"]; | 69 withString:@"_"]; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 184 |
187 // Another thread raced the load and has already cached the image. | 185 // Another thread raced the load and has already cached the image. |
188 if (images_.count(resource_id)) | 186 if (images_.count(resource_id)) |
189 return images_[resource_id]; | 187 return images_[resource_id]; |
190 | 188 |
191 images_[resource_id] = image; | 189 images_[resource_id] = image; |
192 return images_[resource_id]; | 190 return images_[resource_id]; |
193 } | 191 } |
194 | 192 |
195 } // namespace ui | 193 } // namespace ui |
OLD | NEW |