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

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

Issue 6995090: Mac: Disable loading 2x bitmaps on 10.5 and 10.6 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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
« no previous file with comments | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_path.h" 10 #include "base/file_path.h"
11 #include "base/mac/mac_util.h" 11 #include "base/mac/mac_util.h"
12 #include "base/memory/scoped_nsobject.h" 12 #include "base/memory/scoped_nsobject.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "base/sys_info.h"
14 #include "base/sys_string_conversions.h" 15 #include "base/sys_string_conversions.h"
15 #include "ui/gfx/image.h" 16 #include "ui/gfx/image.h"
16 17
17 namespace ui { 18 namespace ui {
18 19
19 namespace { 20 namespace {
20 21
21 FilePath GetResourcesPakFilePath(NSString* name, NSString* mac_locale) { 22 FilePath GetResourcesPakFilePath(NSString* name, NSString* mac_locale) {
22 NSString *resource_path; 23 NSString *resource_path;
23 // Some of the helper processes need to be able to fetch resources 24 // Some of the helper processes need to be able to fetch resources
(...skipping 16 matching lines...) Expand all
40 41
41 } // namespace 42 } // namespace
42 43
43 // static 44 // static
44 FilePath ResourceBundle::GetResourcesFilePath() { 45 FilePath ResourceBundle::GetResourcesFilePath() {
45 return GetResourcesPakFilePath(@"chrome", nil); 46 return GetResourcesPakFilePath(@"chrome", nil);
46 } 47 }
47 48
48 // static 49 // static
49 FilePath ResourceBundle::GetLargeIconResourcesFilePath() { 50 FilePath ResourceBundle::GetLargeIconResourcesFilePath() {
50 return GetResourcesPakFilePath(@"theme_resources_large", nil); 51 int32 major = 0;
52 int32 minor = 0;
53 int32 bugfix = 0;
54 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
55
56 // Only load the large resource pak on if we're running on 10.7 or above.
57 if (major > 10 || (major == 10 && minor >= 7))
58 return GetResourcesPakFilePath(@"theme_resources_large", nil);
59 else
60 return FilePath();
51 } 61 }
52 62
53 // static 63 // static
54 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { 64 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) {
55 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); 65 NSString* mac_locale = base::SysUTF8ToNSString(app_locale);
56 66
57 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value. 67 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value.
58 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" 68 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-"
59 withString:@"_"]; 69 withString:@"_"];
60 70
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 images_[resource_id] = image; 130 images_[resource_id] = image;
121 return *image; 131 return *image;
122 } 132 }
123 133
124 LOG(WARNING) << "Unable to load image with id " << resource_id; 134 LOG(WARNING) << "Unable to load image with id " << resource_id;
125 NOTREACHED(); // Want to assert in debug mode. 135 NOTREACHED(); // Want to assert in debug mode.
126 return *GetEmptyImage(); 136 return *GetEmptyImage();
127 } 137 }
128 138
129 } // namespace ui 139 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698