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 "chrome_frame/simple_resource_loader.h" | 5 #include "chrome_frame/simple_resource_loader.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 base::StringPiece data; | 242 base::StringPiece data; |
243 if (!data_pack_->GetStringPiece(message_id, &data)) { | 243 if (!data_pack_->GetStringPiece(message_id, &data)) { |
244 DLOG(ERROR) << "Unable to find string for resource id:" << message_id; | 244 DLOG(ERROR) << "Unable to find string for resource id:" << message_id; |
245 return std::wstring(); | 245 return std::wstring(); |
246 } | 246 } |
247 | 247 |
248 // Data pack encodes strings as either UTF8 or UTF16. | 248 // Data pack encodes strings as either UTF8 or UTF16. |
249 base::string16 msg; | 249 base::string16 msg; |
250 if (data_pack_->GetTextEncodingType() == ui::DataPack::UTF16) { | 250 if (data_pack_->GetTextEncodingType() == ui::DataPack::UTF16) { |
251 msg = base::string16(reinterpret_cast<const char16*>(data.data()), | 251 msg = base::string16(reinterpret_cast<const base::char16*>(data.data()), |
252 data.length() / 2); | 252 data.length() / 2); |
253 } else if (data_pack_->GetTextEncodingType() == ui::DataPack::UTF8) { | 253 } else if (data_pack_->GetTextEncodingType() == ui::DataPack::UTF8) { |
254 msg = base::UTF8ToUTF16(data); | 254 msg = base::UTF8ToUTF16(data); |
255 } | 255 } |
256 return msg; | 256 return msg; |
257 } | 257 } |
258 | 258 |
259 // static | 259 // static |
260 std::wstring SimpleResourceLoader::GetLanguage() { | 260 std::wstring SimpleResourceLoader::GetLanguage() { |
261 return SimpleResourceLoader::GetInstance()->language_; | 261 return SimpleResourceLoader::GetInstance()->language_; |
262 } | 262 } |
263 | 263 |
264 // static | 264 // static |
265 std::wstring SimpleResourceLoader::Get(int message_id) { | 265 std::wstring SimpleResourceLoader::Get(int message_id) { |
266 SimpleResourceLoader* loader = SimpleResourceLoader::GetInstance(); | 266 SimpleResourceLoader* loader = SimpleResourceLoader::GetInstance(); |
267 return loader->GetLocalizedResource(message_id); | 267 return loader->GetLocalizedResource(message_id); |
268 } | 268 } |
269 | 269 |
270 HMODULE SimpleResourceLoader::GetResourceModuleHandle() { | 270 HMODULE SimpleResourceLoader::GetResourceModuleHandle() { |
271 return locale_dll_handle_; | 271 return locale_dll_handle_; |
272 } | 272 } |
OLD | NEW |