| 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 "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/gfx/font.h" | 10 #include "app/gfx/font.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return true; | 98 return true; |
| 99 } else { | 99 } else { |
| 100 return false; | 100 return false; |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 HICON ResourceBundle::LoadThemeIcon(int icon_id) { | 104 HICON ResourceBundle::LoadThemeIcon(int icon_id) { |
| 105 return ::LoadIcon(theme_data_, MAKEINTRESOURCE(icon_id)); | 105 return ::LoadIcon(theme_data_, MAKEINTRESOURCE(icon_id)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 StringPiece ResourceBundle::GetRawDataResource(int resource_id) { | 108 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) { |
| 109 void* data_ptr; | 109 void* data_ptr; |
| 110 size_t data_size; | 110 size_t data_size; |
| 111 if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(), | 111 if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(), |
| 112 resource_id, | 112 resource_id, |
| 113 &data_ptr, | 113 &data_ptr, |
| 114 &data_size)) { | 114 &data_size)) { |
| 115 return StringPiece(static_cast<const char*>(data_ptr), data_size); | 115 return base::StringPiece(static_cast<const char*>(data_ptr), data_size); |
| 116 } else if (locale_resources_data_ && | 116 } else if (locale_resources_data_ && |
| 117 base::GetDataResourceFromModule(locale_resources_data_, | 117 base::GetDataResourceFromModule(locale_resources_data_, |
| 118 resource_id, | 118 resource_id, |
| 119 &data_ptr, | 119 &data_ptr, |
| 120 &data_size)) { | 120 &data_size)) { |
| 121 return StringPiece(static_cast<const char*>(data_ptr), data_size); | 121 return base::StringPiece(static_cast<const char*>(data_ptr), data_size); |
| 122 } | 122 } |
| 123 return StringPiece(); | 123 return base::StringPiece(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Loads and returns a cursor from the current module. | 126 // Loads and returns a cursor from the current module. |
| 127 HCURSOR ResourceBundle::LoadCursor(int cursor_id) { | 127 HCURSOR ResourceBundle::LoadCursor(int cursor_id) { |
| 128 return ::LoadCursor(_AtlBaseModule.GetModuleInstance(), | 128 return ::LoadCursor(_AtlBaseModule.GetModuleInstance(), |
| 129 MAKEINTRESOURCE(cursor_id)); | 129 MAKEINTRESOURCE(cursor_id)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 string16 ResourceBundle::GetLocalizedString(int message_id) { | 132 string16 ResourceBundle::GetLocalizedString(int message_id) { |
| 133 // If for some reason we were unable to load a resource dll, return an empty | 133 // If for some reason we were unable to load a resource dll, return an empty |
| (...skipping 15 matching lines...) Expand all Loading... |
| 149 image = AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(), | 149 image = AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(), |
| 150 message_id); | 150 message_id); |
| 151 if (!image) { | 151 if (!image) { |
| 152 NOTREACHED() << "unable to find resource: " << message_id; | 152 NOTREACHED() << "unable to find resource: " << message_id; |
| 153 return std::wstring(); | 153 return std::wstring(); |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 // Copy into a string16 and return. | 156 // Copy into a string16 and return. |
| 157 return string16(image->achString, image->nLength); | 157 return string16(image->achString, image->nLength); |
| 158 } | 158 } |
| OLD | NEW |