| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/resource_bundle.h" | 5 #include "app/resource_bundle.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 | 8 |
| 9 #include "app/app_paths.h" | 9 #include "app/app_paths.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 reinterpret_cast<const unsigned char*>(data_ptr), data_size); | 95 reinterpret_cast<const unsigned char*>(data_ptr), data_size); |
| 96 } else { | 96 } else { |
| 97 return NULL; | 97 return NULL; |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 HICON ResourceBundle::LoadThemeIcon(int icon_id) { | 101 HICON ResourceBundle::LoadThemeIcon(int icon_id) { |
| 102 return ::LoadIcon(resources_data_, MAKEINTRESOURCE(icon_id)); | 102 return ::LoadIcon(resources_data_, MAKEINTRESOURCE(icon_id)); |
| 103 } | 103 } |
| 104 | 104 |
| 105 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) { | 105 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) const { |
| 106 void* data_ptr; | 106 void* data_ptr; |
| 107 size_t data_size; | 107 size_t data_size; |
| 108 if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(), | 108 if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(), |
| 109 resource_id, | 109 resource_id, |
| 110 &data_ptr, | 110 &data_ptr, |
| 111 &data_size)) { | 111 &data_size)) { |
| 112 return base::StringPiece(static_cast<const char*>(data_ptr), data_size); | 112 return base::StringPiece(static_cast<const char*>(data_ptr), data_size); |
| 113 } else if (locale_resources_data_ && | 113 } else if (locale_resources_data_ && |
| 114 base::GetDataResourceFromModule(locale_resources_data_, | 114 base::GetDataResourceFromModule(locale_resources_data_, |
| 115 resource_id, | 115 resource_id, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 message_id); | 155 message_id); |
| 156 if (!image) { | 156 if (!image) { |
| 157 StackTrace().PrintBacktrace(); // See http://crbug.com/21925. | 157 StackTrace().PrintBacktrace(); // See http://crbug.com/21925. |
| 158 NOTREACHED() << "unable to find resource: " << message_id; | 158 NOTREACHED() << "unable to find resource: " << message_id; |
| 159 return std::wstring(); | 159 return std::wstring(); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 // Copy into a string16 and return. | 162 // Copy into a string16 and return. |
| 163 return string16(image->achString, image->nLength); | 163 return string16(image->achString, image->nLength); |
| 164 } | 164 } |
| OLD | NEW |