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" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 return GetResourcesPakFilePath(@"locale", mac_locale); | 65 return GetResourcesPakFilePath(@"locale", mac_locale); |
66 } | 66 } |
67 | 67 |
68 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { | 68 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { |
69 // Check to see if the image is already in the cache. | 69 // Check to see if the image is already in the cache. |
70 { | 70 { |
71 base::AutoLock lock(*lock_); | 71 base::AutoLock lock(*lock_); |
72 ImageMap::const_iterator found = images_.find(resource_id); | 72 ImageMap::const_iterator found = images_.find(resource_id); |
73 if (found != images_.end()) { | 73 if (found != images_.end()) { |
74 if (!found->second->HasRepresentation(gfx::Image::kNSImageRep)) { | 74 if (!found->second->HasRepresentation(gfx::Image::kImageRepCocoa)) { |
75 DLOG(WARNING) << "ResourceBundle::GetNativeImageNamed() is returning a" | 75 DLOG(WARNING) << "ResourceBundle::GetNativeImageNamed() is returning a" |
76 << " cached gfx::Image that isn't backed by an NSImage. The image" | 76 << " cached gfx::Image that isn't backed by an NSImage. The image" |
77 << " will be converted, rather than going through the NSImage loader." | 77 << " will be converted, rather than going through the NSImage loader." |
78 << " resource_id = " << resource_id; | 78 << " resource_id = " << resource_id; |
79 } | 79 } |
80 return *found->second; | 80 return *found->second; |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 // Load the raw data from the resource pack. | 84 // Load the raw data from the resource pack. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 images_[resource_id] = image; | 120 images_[resource_id] = image; |
121 return *image; | 121 return *image; |
122 } | 122 } |
123 | 123 |
124 LOG(WARNING) << "Unable to load image with id " << resource_id; | 124 LOG(WARNING) << "Unable to load image with id " << resource_id; |
125 NOTREACHED(); // Want to assert in debug mode. | 125 NOTREACHED(); // Want to assert in debug mode. |
126 return *GetEmptyImage(); | 126 return *GetEmptyImage(); |
127 } | 127 } |
128 | 128 |
129 } // namespace ui | 129 } // namespace ui |
OLD | NEW |