Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome_frame/simple_resource_loader.cc

Issue 112433004: Update uses of UTF conversions in chrome_frame/, chromeos/, components/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/protocol_sink_wrap.cc ('k') | chrome_frame/test/chrome_frame_automation_mock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // The full set of preferred languages and their fallbacks are given priority. 125 // The full set of preferred languages and their fallbacks are given priority.
126 std::vector<std::wstring> languages; 126 std::vector<std::wstring> languages;
127 if (base::win::i18n::GetThreadPreferredUILanguageList(&languages)) { 127 if (base::win::i18n::GetThreadPreferredUILanguageList(&languages)) {
128 for (std::vector<std::wstring>::const_iterator scan = languages.begin(), 128 for (std::vector<std::wstring>::const_iterator scan = languages.begin(),
129 end = languages.end(); scan != end; ++scan) { 129 end = languages.end(); scan != end; ++scan) {
130 PushBackIfAbsent(*scan, language_tags); 130 PushBackIfAbsent(*scan, language_tags);
131 } 131 }
132 } 132 }
133 // Use the base i18n routines (i.e., ICU) as a last, best hope for something 133 // Use the base i18n routines (i.e., ICU) as a last, best hope for something
134 // meaningful for the user. 134 // meaningful for the user.
135 PushBackWithFallbackIfAbsent(ASCIIToWide(base::i18n::GetConfiguredLocale()), 135 PushBackWithFallbackIfAbsent(base::ASCIIToWide(
136 base::i18n::GetConfiguredLocale()),
136 language_tags); 137 language_tags);
137 } 138 }
138 139
139 // static 140 // static
140 void SimpleResourceLoader::DetermineLocalesDirectory( 141 void SimpleResourceLoader::DetermineLocalesDirectory(
141 base::FilePath* locales_path) { 142 base::FilePath* locales_path) {
142 DCHECK(locales_path); 143 DCHECK(locales_path);
143 144
144 base::FilePath module_path; 145 base::FilePath module_path;
145 PathService::Get(base::DIR_MODULE, &module_path); 146 PathService::Get(base::DIR_MODULE, &module_path);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 DLOG(ERROR) << "Unable to find string for resource id:" << message_id; 244 DLOG(ERROR) << "Unable to find string for resource id:" << message_id;
244 return std::wstring(); 245 return std::wstring();
245 } 246 }
246 247
247 // Data pack encodes strings as either UTF8 or UTF16. 248 // Data pack encodes strings as either UTF8 or UTF16.
248 base::string16 msg; 249 base::string16 msg;
249 if (data_pack_->GetTextEncodingType() == ui::DataPack::UTF16) { 250 if (data_pack_->GetTextEncodingType() == ui::DataPack::UTF16) {
250 msg = base::string16(reinterpret_cast<const char16*>(data.data()), 251 msg = base::string16(reinterpret_cast<const char16*>(data.data()),
251 data.length() / 2); 252 data.length() / 2);
252 } else if (data_pack_->GetTextEncodingType() == ui::DataPack::UTF8) { 253 } else if (data_pack_->GetTextEncodingType() == ui::DataPack::UTF8) {
253 msg = UTF8ToUTF16(data); 254 msg = base::UTF8ToUTF16(data);
254 } 255 }
255 return msg; 256 return msg;
256 } 257 }
257 258
258 // static 259 // static
259 std::wstring SimpleResourceLoader::GetLanguage() { 260 std::wstring SimpleResourceLoader::GetLanguage() {
260 return SimpleResourceLoader::GetInstance()->language_; 261 return SimpleResourceLoader::GetInstance()->language_;
261 } 262 }
262 263
263 // static 264 // static
264 std::wstring SimpleResourceLoader::Get(int message_id) { 265 std::wstring SimpleResourceLoader::Get(int message_id) {
265 SimpleResourceLoader* loader = SimpleResourceLoader::GetInstance(); 266 SimpleResourceLoader* loader = SimpleResourceLoader::GetInstance();
266 return loader->GetLocalizedResource(message_id); 267 return loader->GetLocalizedResource(message_id);
267 } 268 }
268 269
269 HMODULE SimpleResourceLoader::GetResourceModuleHandle() { 270 HMODULE SimpleResourceLoader::GetResourceModuleHandle() {
270 return locale_dll_handle_; 271 return locale_dll_handle_;
271 } 272 }
OLDNEW
« no previous file with comments | « chrome_frame/protocol_sink_wrap.cc ('k') | chrome_frame/test/chrome_frame_automation_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698