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

Side by Side Diff: ui/base/resource/resource_bundle_mac.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_ios.mm ('k') | ui/base/resource/resource_bundle_unittest.cc » ('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 (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/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 21 matching lines...) Expand all
32 resource_path = [base::mac::FrameworkBundle() pathForResource:name 32 resource_path = [base::mac::FrameworkBundle() pathForResource:name
33 ofType:@"pak" 33 ofType:@"pak"
34 inDirectory:@"" 34 inDirectory:@""
35 forLocalization:mac_locale]; 35 forLocalization:mac_locale];
36 } else { 36 } else {
37 resource_path = [base::mac::FrameworkBundle() pathForResource:name 37 resource_path = [base::mac::FrameworkBundle() pathForResource:name
38 ofType:@"pak"]; 38 ofType:@"pak"];
39 } 39 }
40 40
41 if (!resource_path) { 41 if (!resource_path) {
42 // Trying to load a resources file that doesn't exist is an error. Return 42 // Return just the name of the pack file.
43 // just the name of the pack file so that further down the line it is easier 43 return base::FilePath(base::SysNSStringToUTF8(name) + ".pak");
44 // to track down what happened.
45 std::string name_string = base::SysNSStringToUTF8(name);
46 std::string locale_string = base::SysNSStringToUTF8(mac_locale);
47 LOG(ERROR) << "Tried to get the file path of a non-existent pak file '"
48 << name_string << "' for locale '" << locale_string << "'";
49 return base::FilePath(name_string + ".pak");
50 } 44 }
51 45
52 return base::FilePath([resource_path fileSystemRepresentation]); 46 return base::FilePath([resource_path fileSystemRepresentation]);
53 } 47 }
54 48
55 } // namespace 49 } // namespace
56 50
57 void ResourceBundle::LoadCommonResources() { 51 void ResourceBundle::LoadCommonResources() {
58 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_100_percent", 52 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_100_percent",
59 nil), SCALE_FACTOR_100P); 53 nil), SCALE_FACTOR_100P);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 144
151 // Another thread raced the load and has already cached the image. 145 // Another thread raced the load and has already cached the image.
152 if (images_.count(resource_id)) 146 if (images_.count(resource_id))
153 return images_[resource_id]; 147 return images_[resource_id];
154 148
155 images_[resource_id] = image; 149 images_[resource_id] = image;
156 return images_[resource_id]; 150 return images_[resource_id];
157 } 151 }
158 152
159 } // namespace ui 153 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle_ios.mm ('k') | ui/base/resource/resource_bundle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698