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

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

Issue 419093002: ui: Remove ResourceBundle::LoadCommonResources(). Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: InitParams Created 6 years, 4 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 | Annotate | Revision Log
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/file_util.h" 10 #include "base/file_util.h"
(...skipping 30 matching lines...) Expand all
41 if (!resource_path) { 41 if (!resource_path) {
42 // Return just the name of the pack file. 42 // Return just the name of the pack file.
43 return base::FilePath(base::SysNSStringToUTF8(name) + ".pak"); 43 return base::FilePath(base::SysNSStringToUTF8(name) + ".pak");
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() {
52 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_100_percent",
53 nil), SCALE_FACTOR_100P);
54 AddDataPackFromPath(GetResourcesPakFilePath(@"webkit_resources_100_percent",
55 nil), SCALE_FACTOR_100P);
tony 2014/08/07 16:29:34 Have you verified on OSX we don't need to load web
oshima 2014/08/07 17:01:10 yes, please check if this is needed. If this is ne
tfarina 2014/08/07 17:12:33 The only way I can check is with trybots, as I don
56
57 // On Mac we load 1x and 2x resources and we let the UI framework decide
58 // which one to use.
59 if (IsScaleFactorSupported(SCALE_FACTOR_200P)) {
60 AddDataPackFromPath(GetResourcesPakFilePath(@"chrome_200_percent",
61 nil), SCALE_FACTOR_200P);
62 AddDataPackFromPath(GetResourcesPakFilePath(@"webkit_resources_200_percent",
63 nil), SCALE_FACTOR_200P);
64 }
65 }
66
67 base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, 51 base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale,
68 bool test_file_exists) { 52 bool test_file_exists) {
69 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); 53 NSString* mac_locale = base::SysUTF8ToNSString(app_locale);
70 54
71 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value. 55 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value.
72 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" 56 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-"
73 withString:@"_"]; 57 withString:@"_"];
74 58
75 // On disk, the "en_US" resources are just "en" (http://crbug.com/25578). 59 // On disk, the "en_US" resources are just "en" (http://crbug.com/25578).
76 if ([mac_locale isEqual:@"en_US"]) 60 if ([mac_locale isEqual:@"en_US"])
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 132
149 // Another thread raced the load and has already cached the image. 133 // Another thread raced the load and has already cached the image.
150 if (images_.count(resource_id)) 134 if (images_.count(resource_id))
151 return images_[resource_id]; 135 return images_[resource_id];
152 136
153 images_[resource_id] = image; 137 images_[resource_id] = image;
154 return images_[resource_id]; 138 return images_[resource_id];
155 } 139 }
156 140
157 } // namespace ui 141 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698