OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/common/resource_bundle.h" | 5 #include "chrome/common/resource_bundle.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/gfx/png_decoder.h" | 10 #include "base/gfx/png_decoder.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 return ::LoadIcon(theme_dll_, MAKEINTRESOURCE(icon_id)); | 210 return ::LoadIcon(theme_dll_, MAKEINTRESOURCE(icon_id)); |
211 } | 211 } |
212 | 212 |
213 std::string ResourceBundle::GetDataResource(int resource_id) { | 213 std::string ResourceBundle::GetDataResource(int resource_id) { |
214 return GetRawDataResource(resource_id).as_string(); | 214 return GetRawDataResource(resource_id).as_string(); |
215 } | 215 } |
216 | 216 |
217 StringPiece ResourceBundle::GetRawDataResource(int resource_id) { | 217 StringPiece ResourceBundle::GetRawDataResource(int resource_id) { |
218 void* data_ptr; | 218 void* data_ptr; |
219 size_t data_size; | 219 size_t data_size; |
220 if (base::GetDataResourceFromModule( | 220 if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(), |
221 _AtlBaseModule.GetModuleInstance(), resource_id, &data_ptr, &data_size)) | 221 resource_id, |
| 222 &data_ptr, |
| 223 &data_size)) { |
222 return StringPiece(static_cast<const char*>(data_ptr), data_size); | 224 return StringPiece(static_cast<const char*>(data_ptr), data_size); |
| 225 } else if (locale_resources_dll_ && |
| 226 base::GetDataResourceFromModule(locale_resources_dll_, |
| 227 resource_id, |
| 228 &data_ptr, |
| 229 &data_size)) { |
| 230 return StringPiece(static_cast<const char*>(data_ptr), data_size); |
| 231 } |
223 return StringPiece(); | 232 return StringPiece(); |
224 } | 233 } |
225 | |
226 // Loads and returns the global accelerators from the current module. | 234 // Loads and returns the global accelerators from the current module. |
227 HACCEL ResourceBundle::GetGlobalAccelerators() { | 235 HACCEL ResourceBundle::GetGlobalAccelerators() { |
228 return ::LoadAccelerators(_AtlBaseModule.GetModuleInstance(), | 236 return ::LoadAccelerators(_AtlBaseModule.GetModuleInstance(), |
229 MAKEINTRESOURCE(IDR_MAINFRAME)); | 237 MAKEINTRESOURCE(IDR_MAINFRAME)); |
230 } | 238 } |
231 | 239 |
232 // Loads and returns a cursor from the current module. | 240 // Loads and returns a cursor from the current module. |
233 HCURSOR ResourceBundle::LoadCursor(int cursor_id) { | 241 HCURSOR ResourceBundle::LoadCursor(int cursor_id) { |
234 return ::LoadCursor(_AtlBaseModule.GetModuleInstance(), | 242 return ::LoadCursor(_AtlBaseModule.GetModuleInstance(), |
235 MAKEINTRESOURCE(cursor_id)); | 243 MAKEINTRESOURCE(cursor_id)); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 return *medium_bold_font_; | 304 return *medium_bold_font_; |
297 case LargeFont: | 305 case LargeFont: |
298 return *large_font_; | 306 return *large_font_; |
299 case WebFont: | 307 case WebFont: |
300 return *web_font_; | 308 return *web_font_; |
301 default: | 309 default: |
302 return *base_font_; | 310 return *base_font_; |
303 } | 311 } |
304 } | 312 } |
305 | 313 |
OLD | NEW |