OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/ui/webui/chromeos/login/l10n_util.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // Concatenate most_relevant_locales_display_names and display_names. | 232 // Concatenate most_relevant_locales_display_names and display_names. |
233 // Insert special divider in between. | 233 // Insert special divider in between. |
234 std::vector<base::string16> out_display_names; | 234 std::vector<base::string16> out_display_names; |
235 for (size_t i = 0; i < most_relevant_locales_display_names.size(); ++i) { | 235 for (size_t i = 0; i < most_relevant_locales_display_names.size(); ++i) { |
236 if (most_relevant_locales_display_names[i].size() == 0) | 236 if (most_relevant_locales_display_names[i].size() == 0) |
237 continue; | 237 continue; |
238 out_display_names.push_back(most_relevant_locales_display_names[i]); | 238 out_display_names.push_back(most_relevant_locales_display_names[i]); |
239 } | 239 } |
240 | 240 |
241 base::string16 divider16; | 241 base::string16 divider16; |
242 if (insert_divider && !out_display_names.empty()) { | 242 if (insert_divider) { |
243 // Insert a divider if requested, but only if | |
244 // |most_relevant_locales_display_names| is not empty. | |
245 divider16 = base::ASCIIToUTF16(kMostRelevantLanguagesDivider); | 243 divider16 = base::ASCIIToUTF16(kMostRelevantLanguagesDivider); |
246 out_display_names.push_back(divider16); | 244 out_display_names.push_back(divider16); |
247 } | 245 } |
248 | 246 |
249 std::copy(display_names.begin(), | 247 std::copy(display_names.begin(), |
250 display_names.end(), | 248 display_names.end(), |
251 std::back_inserter(out_display_names)); | 249 std::back_inserter(out_display_names)); |
252 | 250 |
253 // Build the language list from the language map. | 251 // Build the language list from the language map. |
254 scoped_ptr<base::ListValue> language_list(new base::ListValue()); | 252 scoped_ptr<base::ListValue> language_list(new base::ListValue()); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 } | 465 } |
468 | 466 |
469 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { | 467 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { |
470 const input_method::InputMethodDescriptor current_input_method = | 468 const input_method::InputMethodDescriptor current_input_method = |
471 input_method::InputMethodManager::Get()->GetCurrentInputMethod(); | 469 input_method::InputMethodManager::Get()->GetCurrentInputMethod(); |
472 return CreateInputMethodsEntry(current_input_method, | 470 return CreateInputMethodsEntry(current_input_method, |
473 current_input_method.id()); | 471 current_input_method.id()); |
474 } | 472 } |
475 | 473 |
476 } // namespace chromeos | 474 } // namespace chromeos |
OLD | NEW |