OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file defines a helper class for selecting a supported language from a | 5 // This file defines a helper class for selecting a supported language from a |
6 // set of candidates. | 6 // set of candidates. |
7 | 7 |
8 #include "chrome/installer/util/language_selector.h" | 8 #include "chrome/installer/util/language_selector.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 candidates->push_back(language); | 204 candidates->push_back(language); |
205 } | 205 } |
206 | 206 |
207 // Now try the Windows UI languages. Use the thread preferred since that will | 207 // Now try the Windows UI languages. Use the thread preferred since that will |
208 // kindly return us a list of all kinds of fallbacks. | 208 // kindly return us a list of all kinds of fallbacks. |
209 base::win::i18n::GetThreadPreferredUILanguageList(candidates); | 209 base::win::i18n::GetThreadPreferredUILanguageList(candidates); |
210 } | 210 } |
211 | 211 |
212 } // namespace | 212 } // namespace |
213 | 213 |
214 namespace installer { | 214 namespace installer_util { |
215 | 215 |
216 LanguageSelector::LanguageSelector() | 216 LanguageSelector::LanguageSelector() |
217 : offset_(arraysize(kLanguageOffsetPairs)) { | 217 : offset_(arraysize(kLanguageOffsetPairs)) { |
218 #if !defined(NDEBUG) | 218 #if !defined(NDEBUG) |
219 ValidateMappings(); | 219 ValidateMappings(); |
220 #endif // !defined(NDEBUG) | 220 #endif // !defined(NDEBUG) |
221 std::vector<std::wstring> candidates; | 221 std::vector<std::wstring> candidates; |
222 | 222 |
223 GetCandidatesFromSystem(&candidates); | 223 GetCandidatesFromSystem(&candidates); |
224 DoSelect(candidates); | 224 DoSelect(candidates); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 &offset_)) { | 291 &offset_)) { |
292 VLOG(1) << "No suitable language found for any candidates."; | 292 VLOG(1) << "No suitable language found for any candidates."; |
293 | 293 |
294 // Our fallback is "en-us" | 294 // Our fallback is "en-us" |
295 matched_candidate_.assign(&kFallbackLanguage[0], | 295 matched_candidate_.assign(&kFallbackLanguage[0], |
296 arraysize(kFallbackLanguage) - 1); | 296 arraysize(kFallbackLanguage) - 1); |
297 offset_ = kFallbackLanguageOffset; | 297 offset_ = kFallbackLanguageOffset; |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 } // namespace installer | 301 } // namespace installer_util |
OLD | NEW |