Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: ui/base/resource/resource_bundle_ios.mm

Issue 661503003: Revert of Eliminate silently letting errors pass on pak loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/resource/resource_bundle.cc ('k') | ui/base/resource/resource_bundle_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 NSString *resource_path; 27 NSString *resource_path;
28 if ([mac_locale length]) { 28 if ([mac_locale length]) {
29 resource_path = [base::mac::FrameworkBundle() pathForResource:name 29 resource_path = [base::mac::FrameworkBundle() pathForResource:name
30 ofType:@"pak" 30 ofType:@"pak"
31 inDirectory:@"" 31 inDirectory:@""
32 forLocalization:mac_locale]; 32 forLocalization:mac_locale];
33 } else { 33 } else {
34 resource_path = [base::mac::FrameworkBundle() pathForResource:name 34 resource_path = [base::mac::FrameworkBundle() pathForResource:name
35 ofType:@"pak"]; 35 ofType:@"pak"];
36 } 36 }
37
38 if (!resource_path) { 37 if (!resource_path) {
39 // Trying to load a resources file that doesn't exist is an error. Return 38 // Return just the name of the pak file.
40 // just the name of the pack file so that further down the line it is easier 39 return base::FilePath(base::SysNSStringToUTF8(name) + ".pak");
41 // to track down what happened.
42 std::string name_string = base::SysNSStringToUTF8(name);
43 std::string locale_string = base::SysNSStringToUTF8(mac_locale);
44 LOG(ERROR) << "Tried to get the file path of a non-existent pak file '"
45 << name_string << "' for locale '" << locale_string << "'";
46 return base::FilePath(name_string + ".pak");
47 } 40 }
48 return base::FilePath([resource_path fileSystemRepresentation]); 41 return base::FilePath([resource_path fileSystemRepresentation]);
49 } 42 }
50 43
51 } // namespace 44 } // namespace
52 45
53 void ResourceBundle::LoadCommonResources() { 46 void ResourceBundle::LoadCommonResources() {
54 if (IsScaleFactorSupported(SCALE_FACTOR_100P)) { 47 if (IsScaleFactorSupported(SCALE_FACTOR_100P)) {
55 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_100_percent", nil), 48 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_100_percent", nil),
56 SCALE_FACTOR_100P); 49 SCALE_FACTOR_100P);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 186
194 // Another thread raced the load and has already cached the image. 187 // Another thread raced the load and has already cached the image.
195 if (images_.count(resource_id)) 188 if (images_.count(resource_id))
196 return images_[resource_id]; 189 return images_[resource_id];
197 190
198 images_[resource_id] = image; 191 images_[resource_id] = image;
199 return images_[resource_id]; 192 return images_[resource_id];
200 } 193 }
201 194
202 } // namespace ui 195 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle.cc ('k') | ui/base/resource/resource_bundle_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698