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

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

Issue 537063002: Eliminate silently letting errors pass on pak loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one last time 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
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 // Return just the name of the pack file. 42 // Trying to load a resources file that doesn't exist is an error. Return
43 return base::FilePath(base::SysNSStringToUTF8(name) + ".pak"); 43 // just the name of the pack file so that further down the line it is easier
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");
44 } 50 }
45 51
46 return base::FilePath([resource_path fileSystemRepresentation]); 52 return base::FilePath([resource_path fileSystemRepresentation]);
47 } 53 }
48 54
49 } // namespace 55 } // namespace
50 56
51 void ResourceBundle::LoadCommonResources() { 57 void ResourceBundle::LoadCommonResources() {
52 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_100_percent", 58 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_100_percent",
53 nil), SCALE_FACTOR_100P); 59 nil), SCALE_FACTOR_100P);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 150
145 // Another thread raced the load and has already cached the image. 151 // Another thread raced the load and has already cached the image.
146 if (images_.count(resource_id)) 152 if (images_.count(resource_id))
147 return images_[resource_id]; 153 return images_[resource_id];
148 154
149 images_[resource_id] = image; 155 images_[resource_id] = image;
150 return images_[resource_id]; 156 return images_[resource_id];
151 } 157 }
152 158
153 } // namespace ui 159 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698