OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/base/l10n/l10n_util_win.h" | 5 #include "ui/base/l10n/l10n_util_win.h" |
6 | 6 |
7 #include <windowsx.h> | 7 #include <windowsx.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iterator> | 9 #include <iterator> |
10 | 10 |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/utf_string_conversions.h" |
14 #include "base/win/i18n.h" | 15 #include "base/win/i18n.h" |
15 #include "base/win/windows_version.h" | 16 #include "base/win/windows_version.h" |
16 #include "grit/app_locale_settings.h" | 17 #include "grit/app_locale_settings.h" |
17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/gfx/display.h" | 19 #include "ui/gfx/display.h" |
19 #include "ui/gfx/win/dpi.h" | 20 #include "ui/gfx/win/dpi.h" |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 void AdjustLogFont(const base::string16& font_family, | 24 void AdjustLogFont(const base::string16& font_family, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 double dpi_scale = 1; | 179 double dpi_scale = 1; |
179 AdjustLogFont(ui_font_family, ui_font_size_scaler, dpi_scale, &logfont); | 180 AdjustLogFont(ui_font_family, ui_font_size_scaler, dpi_scale, &logfont); |
180 HFONT hfont = CreateFontIndirect(&logfont); | 181 HFONT hfont = CreateFontIndirect(&logfont); |
181 if (hfont) | 182 if (hfont) |
182 SetWindowFont(hwnd, hfont, FALSE); | 183 SetWindowFont(hwnd, hfont, FALSE); |
183 } | 184 } |
184 } | 185 } |
185 } | 186 } |
186 | 187 |
187 void OverrideLocaleWithUILanguageList() { | 188 void OverrideLocaleWithUILanguageList() { |
188 std::vector<std::wstring> ui_languages; | 189 std::vector<base::string16> ui_languages; |
189 if (base::win::i18n::GetThreadPreferredUILanguageList(&ui_languages)) { | 190 if (base::win::i18n::GetThreadPreferredUILanguageList(&ui_languages)) { |
190 std::vector<std::string> ascii_languages; | 191 std::vector<std::string> ascii_languages; |
191 ascii_languages.reserve(ui_languages.size()); | 192 ascii_languages.reserve(ui_languages.size()); |
192 std::transform(ui_languages.begin(), ui_languages.end(), | 193 std::transform(ui_languages.begin(), ui_languages.end(), |
193 std::back_inserter(ascii_languages), &WideToASCII); | 194 std::back_inserter(ascii_languages), &base::UTF16ToASCII); |
194 override_locale_holder.Get().swap_value(&ascii_languages); | 195 override_locale_holder.Get().swap_value(&ascii_languages); |
195 } else { | 196 } else { |
196 NOTREACHED() << "Failed to determine the UI language for locale override."; | 197 NOTREACHED() << "Failed to determine the UI language for locale override."; |
197 } | 198 } |
198 } | 199 } |
199 | 200 |
200 const std::vector<std::string>& GetLocaleOverrides() { | 201 const std::vector<std::string>& GetLocaleOverrides() { |
201 return override_locale_holder.Get().value(); | 202 return override_locale_holder.Get().value(); |
202 } | 203 } |
203 | 204 |
204 } // namespace l10n_util | 205 } // namespace l10n_util |
OLD | NEW |