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