| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 &layouts); | 315 &layouts); |
| 316 GetAndMergeKeyboardLayoutsForLocale(util, resolved_locale, &selected, | 316 GetAndMergeKeyboardLayoutsForLocale(util, resolved_locale, &selected, |
| 317 &layouts); | 317 &layouts); |
| 318 | 318 |
| 319 std::unique_ptr<base::ListValue> input_methods_list(new base::ListValue); | 319 std::unique_ptr<base::ListValue> input_methods_list(new base::ListValue); |
| 320 std::set<std::string> input_methods_added; | 320 std::set<std::string> input_methods_added; |
| 321 for (std::vector<std::string>::const_iterator it = layouts.begin(); | 321 for (std::vector<std::string>::const_iterator it = layouts.begin(); |
| 322 it != layouts.end(); ++it) { | 322 it != layouts.end(); ++it) { |
| 323 const input_method::InputMethodDescriptor* ime = | 323 const input_method::InputMethodDescriptor* ime = |
| 324 util->GetInputMethodDescriptorFromId(*it); | 324 util->GetInputMethodDescriptorFromId(*it); |
| 325 // TODO(tbarzic): This is added to avoid crash loop on starting public |
| 326 // session. The problem should be properly fixed, and this workaround |
| 327 // removed. |
| 328 if (!ime) { |
| 329 LOG(WARNING) << *it << " layout not found."; |
| 330 continue; |
| 331 } |
| 325 if (!InsertString(ime->id(), &input_methods_added)) | 332 if (!InsertString(ime->id(), &input_methods_added)) |
| 326 continue; | 333 continue; |
| 327 input_methods_list->Append(CreateInputMethodsEntry(*ime, selected)); | 334 input_methods_list->Append(CreateInputMethodsEntry(*ime, selected)); |
| 328 } | 335 } |
| 329 | 336 |
| 330 callback.Run(std::move(input_methods_list)); | 337 callback.Run(std::move(input_methods_list)); |
| 331 } | 338 } |
| 332 | 339 |
| 333 // For "UI Language" drop-down menu at OOBE screen we need to decide which | 340 // For "UI Language" drop-down menu at OOBE screen we need to decide which |
| 334 // entry to mark "selected". If user has just selected "requested_locale", | 341 // entry to mark "selected". If user has just selected "requested_locale", |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 std::unique_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { | 604 std::unique_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { |
| 598 const input_method::InputMethodDescriptor current_input_method = | 605 const input_method::InputMethodDescriptor current_input_method = |
| 599 input_method::InputMethodManager::Get() | 606 input_method::InputMethodManager::Get() |
| 600 ->GetActiveIMEState() | 607 ->GetActiveIMEState() |
| 601 ->GetCurrentInputMethod(); | 608 ->GetCurrentInputMethod(); |
| 602 return CreateInputMethodsEntry(current_input_method, | 609 return CreateInputMethodsEntry(current_input_method, |
| 603 current_input_method.id()); | 610 current_input_method.id()); |
| 604 } | 611 } |
| 605 | 612 |
| 606 } // namespace chromeos | 613 } // namespace chromeos |
| OLD | NEW |