OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/chrome_browser_main_chromeos.h" | 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 // static | 574 // static |
575 void GuestLanguageSetCallbackData::Callback( | 575 void GuestLanguageSetCallbackData::Callback( |
576 const scoped_ptr<GuestLanguageSetCallbackData>& self, | 576 const scoped_ptr<GuestLanguageSetCallbackData>& self, |
577 const std::string& locale, | 577 const std::string& locale, |
578 const std::string& loaded_locale, | 578 const std::string& loaded_locale, |
579 bool success) { | 579 bool success) { |
580 input_method::InputMethodManager* const ime_manager = | 580 input_method::InputMethodManager* const ime_manager = |
581 input_method::InputMethodManager::Get(); | 581 input_method::InputMethodManager::Get(); |
582 // Active layout must be hardware "login layout". | 582 // Active layout must be hardware "login layout". |
583 // The previous one must be "locale default layout". | 583 // The previous one must be "locale default layout". |
584 const std::string login_input_method = | 584 // First, enable all hardware input methods. |
585 ime_manager->GetInputMethodUtil()->GetHardwareLoginInputMethodId(); | 585 const std::vector<std::string>& input_methods = |
586 ime_manager->ChangeInputMethod(login_input_method); | 586 ime_manager->GetInputMethodUtil()->GetHardwareInputMethodIds(); |
| 587 for (size_t i = 0; i < input_methods.size(); ++i) |
| 588 ime_manager->EnableInputMethod(input_methods[i]); |
587 | 589 |
| 590 // Second, enable locale based input methods. |
588 const std::string locale_default_input_method = | 591 const std::string locale_default_input_method = |
589 ime_manager->GetInputMethodUtil()-> | 592 ime_manager->GetInputMethodUtil()-> |
590 GetLanguageDefaultInputMethodId(loaded_locale); | 593 GetLanguageDefaultInputMethodId(loaded_locale); |
591 if (!locale_default_input_method.empty()) { | 594 if (!locale_default_input_method.empty()) { |
592 PrefService* user_prefs = self->profile->GetPrefs(); | 595 PrefService* user_prefs = self->profile->GetPrefs(); |
593 user_prefs->SetString(prefs::kLanguagePreviousInputMethod, | 596 user_prefs->SetString(prefs::kLanguagePreviousInputMethod, |
594 locale_default_input_method); | 597 locale_default_input_method); |
| 598 ime_manager->EnableInputMethod(locale_default_input_method); |
595 } | 599 } |
| 600 |
| 601 // Finally, activate the first login input method. |
| 602 const std::vector<std::string>& login_input_methods = |
| 603 ime_manager->GetInputMethodUtil()->GetHardwareLoginInputMethodIds(); |
| 604 ime_manager->ChangeInputMethod(login_input_methods[0]); |
596 } | 605 } |
597 | 606 |
598 void SetGuestLocale(UserManager* const usermanager, Profile* const profile) { | 607 void SetGuestLocale(UserManager* const usermanager, Profile* const profile) { |
599 scoped_ptr<GuestLanguageSetCallbackData> data( | 608 scoped_ptr<GuestLanguageSetCallbackData> data( |
600 new GuestLanguageSetCallbackData(profile)); | 609 new GuestLanguageSetCallbackData(profile)); |
601 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 610 scoped_ptr<locale_util::SwitchLanguageCallback> callback( |
602 new locale_util::SwitchLanguageCallback(base::Bind( | 611 new locale_util::SwitchLanguageCallback(base::Bind( |
603 &GuestLanguageSetCallbackData::Callback, base::Passed(data.Pass())))); | 612 &GuestLanguageSetCallbackData::Callback, base::Passed(data.Pass())))); |
604 User* const user = usermanager->GetUserByProfile(profile); | 613 User* const user = usermanager->GetUserByProfile(profile); |
605 usermanager->RespectLocalePreference(profile, user, callback.Pass()); | 614 usermanager->RespectLocalePreference(profile, user, callback.Pass()); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 // Destroy DBus services immediately after threads are stopped. | 839 // Destroy DBus services immediately after threads are stopped. |
831 dbus_services_.reset(); | 840 dbus_services_.reset(); |
832 | 841 |
833 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 842 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
834 | 843 |
835 // Destroy DeviceSettingsService after g_browser_process. | 844 // Destroy DeviceSettingsService after g_browser_process. |
836 DeviceSettingsService::Shutdown(); | 845 DeviceSettingsService::Shutdown(); |
837 } | 846 } |
838 | 847 |
839 } // namespace chromeos | 848 } // namespace chromeos |
OLD | NEW |