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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/l10n_util.cc

Issue 426063005: Allow recommended locales to be set for public sessions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix buffer overflow in test. Created 6 years, 4 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
OLDNEW
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
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) { 242 if (insert_divider && !out_display_names.empty()) {
243 // Insert a divider if requested, but only if
244 // |most_relevant_locales_display_names| is not empty.
243 divider16 = base::ASCIIToUTF16(kMostRelevantLanguagesDivider); 245 divider16 = base::ASCIIToUTF16(kMostRelevantLanguagesDivider);
244 out_display_names.push_back(divider16); 246 out_display_names.push_back(divider16);
245 } 247 }
246 248
247 std::copy(display_names.begin(), 249 std::copy(display_names.begin(),
248 display_names.end(), 250 display_names.end(),
249 std::back_inserter(out_display_names)); 251 std::back_inserter(out_display_names));
250 252
251 // Build the language list from the language map. 253 // Build the language list from the language map.
252 scoped_ptr<base::ListValue> language_list(new base::ListValue()); 254 scoped_ptr<base::ListValue> language_list(new base::ListValue());
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 467 }
466 468
467 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { 469 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() {
468 const input_method::InputMethodDescriptor current_input_method = 470 const input_method::InputMethodDescriptor current_input_method =
469 input_method::InputMethodManager::Get()->GetCurrentInputMethod(); 471 input_method::InputMethodManager::Get()->GetCurrentInputMethod();
470 return CreateInputMethodsEntry(current_input_method, 472 return CreateInputMethodsEntry(current_input_method,
471 current_input_method.id()); 473 current_input_method.id());
472 } 474 }
473 475
474 } // namespace chromeos 476 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698