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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 const std::string app_locale = g_browser_process->GetApplicationLocale(); | 375 const std::string app_locale = g_browser_process->GetApplicationLocale(); |
376 std::vector<std::string> accept_language_codes; | 376 std::vector<std::string> accept_language_codes; |
377 l10n_util::GetAcceptLanguagesForLocale(app_locale, &accept_language_codes); | 377 l10n_util::GetAcceptLanguagesForLocale(app_locale, &accept_language_codes); |
378 return GetLanguageList( | 378 return GetLanguageList( |
379 *input_method::InputMethodManager::Get()->GetSupportedInputMethods(), | 379 *input_method::InputMethodManager::Get()->GetSupportedInputMethods(), |
380 accept_language_codes, | 380 accept_language_codes, |
381 StartupCustomizationDocument::GetInstance()->configured_locales(), | 381 StartupCustomizationDocument::GetInstance()->configured_locales(), |
382 false); | 382 false); |
383 } | 383 } |
384 | 384 |
385 scoped_ptr<base::ListValue> GetLoginKeyboardLayouts( | 385 scoped_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts( |
386 const std::string& locale, | 386 const std::string& locale, |
387 const std::string& selected) { | 387 const std::string& selected) { |
388 scoped_ptr<base::ListValue> input_methods_list(new base::ListValue); | 388 scoped_ptr<base::ListValue> input_methods_list(new base::ListValue); |
389 input_method::InputMethodManager* manager = | 389 input_method::InputMethodManager* manager = |
390 input_method::InputMethodManager::Get(); | 390 input_method::InputMethodManager::Get(); |
391 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); | 391 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); |
392 | 392 |
393 const std::vector<std::string>& hardware_login_input_methods = | 393 const std::vector<std::string>& hardware_login_input_methods = |
394 util->GetHardwareLoginInputMethodIds(); | 394 util->GetHardwareLoginInputMethodIds(); |
395 manager->EnableLoginLayouts(locale, hardware_login_input_methods); | 395 |
| 396 manager->GetActiveIMEState()->EnableLoginLayouts( |
| 397 locale, hardware_login_input_methods); |
396 | 398 |
397 scoped_ptr<input_method::InputMethodDescriptors> input_methods( | 399 scoped_ptr<input_method::InputMethodDescriptors> input_methods( |
398 manager->GetActiveInputMethods()); | 400 manager->GetActiveIMEState()->GetActiveInputMethods()); |
399 std::set<std::string> input_methods_added; | 401 std::set<std::string> input_methods_added; |
400 | 402 |
401 for (std::vector<std::string>::const_iterator i = | 403 for (std::vector<std::string>::const_iterator i = |
402 hardware_login_input_methods.begin(); | 404 hardware_login_input_methods.begin(); |
403 i != hardware_login_input_methods.end(); | 405 i != hardware_login_input_methods.end(); |
404 ++i) { | 406 ++i) { |
405 const input_method::InputMethodDescriptor* ime = | 407 const input_method::InputMethodDescriptor* ime = |
406 util->GetInputMethodDescriptorFromId(*i); | 408 util->GetInputMethodDescriptorFromId(*i); |
407 // Do not crash in case of misconfiguration. | 409 // Do not crash in case of misconfiguration. |
408 if (ime) { | 410 if (ime) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 background_task_runner, | 463 background_task_runner, |
462 FROM_HERE, | 464 FROM_HERE, |
463 base::Bind(&l10n_util::GetApplicationLocale, | 465 base::Bind(&l10n_util::GetApplicationLocale, |
464 locale), | 466 locale), |
465 base::Bind(&GetKeyboardLayoutsForResolvedLocale, | 467 base::Bind(&GetKeyboardLayoutsForResolvedLocale, |
466 callback)); | 468 callback)); |
467 } | 469 } |
468 | 470 |
469 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { | 471 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() { |
470 const input_method::InputMethodDescriptor current_input_method = | 472 const input_method::InputMethodDescriptor current_input_method = |
471 input_method::InputMethodManager::Get()->GetCurrentInputMethod(); | 473 input_method::InputMethodManager::Get() |
| 474 ->GetActiveIMEState() |
| 475 ->GetCurrentInputMethod(); |
472 return CreateInputMethodsEntry(current_input_method, | 476 return CreateInputMethodsEntry(current_input_method, |
473 current_input_method.id()); | 477 current_input_method.id()); |
474 } | 478 } |
475 | 479 |
476 } // namespace chromeos | 480 } // namespace chromeos |
OLD | NEW |