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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <iterator> | 9 #include <iterator> |
10 #include <map> | 10 #include <map> |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 const std::vector<std::string>& most_relevant_language_codes, | 470 const std::vector<std::string>& most_relevant_language_codes, |
471 const base::ListValue& available_locales, | 471 const base::ListValue& available_locales, |
472 const std::string& fallback_locale) { | 472 const std::string& fallback_locale) { |
473 for (std::vector<std::string>::const_iterator most_relevant_it = | 473 for (std::vector<std::string>::const_iterator most_relevant_it = |
474 most_relevant_language_codes.begin(); | 474 most_relevant_language_codes.begin(); |
475 most_relevant_it != most_relevant_language_codes.end(); | 475 most_relevant_it != most_relevant_language_codes.end(); |
476 ++most_relevant_it) { | 476 ++most_relevant_it) { |
477 for (base::ListValue::const_iterator available_it = | 477 for (base::ListValue::const_iterator available_it = |
478 available_locales.begin(); | 478 available_locales.begin(); |
479 available_it != available_locales.end(); ++available_it) { | 479 available_it != available_locales.end(); ++available_it) { |
480 const base::DictionaryValue* dict; | 480 base::DictionaryValue* dict; |
481 std::string available_locale; | 481 std::string available_locale; |
482 if (!available_it->GetAsDictionary(&dict) || | 482 if (!(*available_it)->GetAsDictionary(&dict) || |
483 !dict->GetString("value", &available_locale)) { | 483 !dict->GetString("value", &available_locale)) { |
484 NOTREACHED(); | 484 NOTREACHED(); |
485 continue; | 485 continue; |
486 } | 486 } |
487 if (available_locale == *most_relevant_it) | 487 if (available_locale == *most_relevant_it) |
488 return *most_relevant_it; | 488 return *most_relevant_it; |
489 } | 489 } |
490 } | 490 } |
491 | 491 |
492 return fallback_locale; | 492 return fallback_locale; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 std::unique_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { | 597 std::unique_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { |
598 const input_method::InputMethodDescriptor current_input_method = | 598 const input_method::InputMethodDescriptor current_input_method = |
599 input_method::InputMethodManager::Get() | 599 input_method::InputMethodManager::Get() |
600 ->GetActiveIMEState() | 600 ->GetActiveIMEState() |
601 ->GetCurrentInputMethod(); | 601 ->GetCurrentInputMethod(); |
602 return CreateInputMethodsEntry(current_input_method, | 602 return CreateInputMethodsEntry(current_input_method, |
603 current_input_method.id()); | 603 current_input_method.id()); |
604 } | 604 } |
605 | 605 |
606 } // namespace chromeos | 606 } // namespace chromeos |
OLD | NEW |