OLD | NEW |
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 Loading... |
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. |
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 Loading... |
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 |
OLD | NEW |