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

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

Issue 7144007: Improve and unify Mac OS X run-time version checks (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
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"
15 #include "base/sys_string_conversions.h" 14 #include "base/sys_string_conversions.h"
16 #include "ui/gfx/image.h" 15 #include "ui/gfx/image.h"
17 16
18 namespace ui { 17 namespace ui {
19 18
20 namespace { 19 namespace {
21 20
22 FilePath GetResourcesPakFilePath(NSString* name, NSString* mac_locale) { 21 FilePath GetResourcesPakFilePath(NSString* name, NSString* mac_locale) {
23 NSString *resource_path; 22 NSString *resource_path;
24 // Some of the helper processes need to be able to fetch resources 23 // Some of the helper processes need to be able to fetch resources
(...skipping 16 matching lines...) Expand all
41 40
42 } // namespace 41 } // namespace
43 42
44 // static 43 // static
45 FilePath ResourceBundle::GetResourcesFilePath() { 44 FilePath ResourceBundle::GetResourcesFilePath() {
46 return GetResourcesPakFilePath(@"chrome", nil); 45 return GetResourcesPakFilePath(@"chrome", nil);
47 } 46 }
48 47
49 // static 48 // static
50 FilePath ResourceBundle::GetLargeIconResourcesFilePath() { 49 FilePath ResourceBundle::GetLargeIconResourcesFilePath() {
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. 50 // Only load the large resource pak on if we're running on 10.7 or above.
Avi (use Gerrit) 2011/06/14 17:50:17 drop "on": "... pak if we're running ..."
Mark Mentovai 2011/06/14 18:00:18 Avi wrote:
57 if (major > 10 || (major == 10 && minor >= 7)) 51 if (base::mac::IsOSLionOrLater())
58 return GetResourcesPakFilePath(@"theme_resources_large", nil); 52 return GetResourcesPakFilePath(@"theme_resources_large", nil);
59 else 53 else
60 return FilePath(); 54 return FilePath();
61 } 55 }
62 56
63 // static 57 // static
64 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { 58 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) {
65 NSString* mac_locale = base::SysUTF8ToNSString(app_locale); 59 NSString* mac_locale = base::SysUTF8ToNSString(app_locale);
66 60
67 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value. 61 // Mac OS X uses "_" instead of "-", so swap to get a Mac-style value.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 images_[resource_id] = image; 124 images_[resource_id] = image;
131 return *image; 125 return *image;
132 } 126 }
133 127
134 LOG(WARNING) << "Unable to load image with id " << resource_id; 128 LOG(WARNING) << "Unable to load image with id " << resource_id;
135 NOTREACHED(); // Want to assert in debug mode. 129 NOTREACHED(); // Want to assert in debug mode.
136 return *GetEmptyImage(); 130 return *GetEmptyImage();
137 } 131 }
138 132
139 } // namespace ui 133 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698