| OLD | NEW |
| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 if (delegate_) { | 84 if (delegate_) { |
| 85 locale_file_path = | 85 locale_file_path = |
| 86 delegate_->GetPathForLocalePack(locale_file_path, app_locale); | 86 delegate_->GetPathForLocalePack(locale_file_path, app_locale); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Don't try to load empty values or values that are not absolute paths. | 89 // Don't try to load empty values or values that are not absolute paths. |
| 90 if (locale_file_path.empty() || !locale_file_path.IsAbsolute()) | 90 if (locale_file_path.empty() || !locale_file_path.IsAbsolute()) |
| 91 return base::FilePath(); | 91 return base::FilePath(); |
| 92 | 92 |
| 93 if (test_file_exists && !file_util::PathExists(locale_file_path)) | 93 if (test_file_exists && !base::PathExists(locale_file_path)) |
| 94 return base::FilePath(); | 94 return base::FilePath(); |
| 95 | 95 |
| 96 return locale_file_path; | 96 return locale_file_path; |
| 97 } | 97 } |
| 98 | 98 |
| 99 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { | 99 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { |
| 100 // Flipped images are not used on Mac. | 100 // Flipped images are not used on Mac. |
| 101 DCHECK_EQ(rtl, RTL_DISABLED); | 101 DCHECK_EQ(rtl, RTL_DISABLED); |
| 102 | 102 |
| 103 // Check to see if the image is already in the cache. | 103 // Check to see if the image is already in the cache. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 // Another thread raced the load and has already cached the image. | 151 // Another thread raced the load and has already cached the image. |
| 152 if (images_.count(resource_id)) | 152 if (images_.count(resource_id)) |
| 153 return images_[resource_id]; | 153 return images_[resource_id]; |
| 154 | 154 |
| 155 images_[resource_id] = image; | 155 images_[resource_id] = image; |
| 156 return images_[resource_id]; | 156 return images_[resource_id]; |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace ui | 159 } // namespace ui |
| OLD | NEW |