| 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 } | |
| 332 if (!InsertString(ime->id(), &input_methods_added)) | 325 if (!InsertString(ime->id(), &input_methods_added)) |
| 333 continue; | 326 continue; |
| 334 input_methods_list->Append(CreateInputMethodsEntry(*ime, selected)); | 327 input_methods_list->Append(CreateInputMethodsEntry(*ime, selected)); |
| 335 } | 328 } |
| 336 | 329 |
| 337 callback.Run(std::move(input_methods_list)); | 330 callback.Run(std::move(input_methods_list)); |
| 338 } | 331 } |
| 339 | 332 |
| 340 // For "UI Language" drop-down menu at OOBE screen we need to decide which | 333 // For "UI Language" drop-down menu at OOBE screen we need to decide which |
| 341 // entry to mark "selected". If user has just selected "requested_locale", | 334 // entry to mark "selected". If user has just selected "requested_locale", |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 std::unique_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { | 597 std::unique_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { |
| 605 const input_method::InputMethodDescriptor current_input_method = | 598 const input_method::InputMethodDescriptor current_input_method = |
| 606 input_method::InputMethodManager::Get() | 599 input_method::InputMethodManager::Get() |
| 607 ->GetActiveIMEState() | 600 ->GetActiveIMEState() |
| 608 ->GetCurrentInputMethod(); | 601 ->GetCurrentInputMethod(); |
| 609 return CreateInputMethodsEntry(current_input_method, | 602 return CreateInputMethodsEntry(current_input_method, |
| 610 current_input_method.id()); | 603 current_input_method.id()); |
| 611 } | 604 } |
| 612 | 605 |
| 613 } // namespace chromeos | 606 } // namespace chromeos |
| OLD | NEW |