Chromium Code Reviews| 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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 // static | 573 // static |
| 574 void GuestLanguageSetCallbackData::Callback( | 574 void GuestLanguageSetCallbackData::Callback( |
| 575 const scoped_ptr<GuestLanguageSetCallbackData>& self, | 575 const scoped_ptr<GuestLanguageSetCallbackData>& self, |
| 576 const std::string& locale, | 576 const std::string& locale, |
| 577 const std::string& loaded_locale, | 577 const std::string& loaded_locale, |
| 578 bool success) { | 578 bool success) { |
| 579 input_method::InputMethodManager* const ime_manager = | 579 input_method::InputMethodManager* const ime_manager = |
| 580 input_method::InputMethodManager::Get(); | 580 input_method::InputMethodManager::Get(); |
| 581 // Active layout must be hardware "login layout". | 581 // Active layout must be hardware "login layout". |
| 582 // The previous one must be "locale default layout". | 582 // The previous one must be "locale default layout". |
| 583 const std::string login_input_method = | 583 // First, enable all hardware input methods. |
| 584 ime_manager->GetInputMethodUtil()->GetHardwareLoginInputMethodId(); | 584 const std::vector<std::string>& input_methods = |
| 585 ime_manager->ChangeInputMethod(login_input_method); | 585 ime_manager->GetInputMethodUtil()->GetHardwareInputMethodIds(); |
| 586 for (size_t i = 0; i < input_methods.size(); ++i) | |
| 587 ime_manager->EnableInputMethod(input_methods[i]); | |
|
Hiro Komatsu
2014/02/14 07:16:51
EnableInputMethods?
Seigo Nonaka
2014/02/14 08:13:22
Done.
Alexander Alekseev
2014/02/14 13:59:17
NO!
Historically EnableInputMethods() is actually
Seigo Nonaka
2014/02/16 15:50:30
Nice catch!
Reverted to previous impl and renamed
| |
| 586 | 588 |
| 589 // Second, enable locale based input methods. | |
| 587 const std::string locale_default_input_method = | 590 const std::string locale_default_input_method = |
| 588 ime_manager->GetInputMethodUtil()-> | 591 ime_manager->GetInputMethodUtil()-> |
| 589 GetLanguageDefaultInputMethodId(loaded_locale); | 592 GetLanguageDefaultInputMethodId(loaded_locale); |
| 590 if (!locale_default_input_method.empty()) { | 593 if (!locale_default_input_method.empty()) { |
| 591 PrefService* user_prefs = self->profile->GetPrefs(); | 594 PrefService* user_prefs = self->profile->GetPrefs(); |
| 592 user_prefs->SetString(prefs::kLanguagePreviousInputMethod, | 595 user_prefs->SetString(prefs::kLanguagePreviousInputMethod, |
| 593 locale_default_input_method); | 596 locale_default_input_method); |
| 597 ime_manager->EnableInputMethod(locale_default_input_method); | |
| 594 } | 598 } |
| 599 | |
| 600 // Finally, actrivate the first login input method. | |
|
Hiro Komatsu
2014/02/14 07:16:51
typo: activate
Seigo Nonaka
2014/02/14 08:13:22
Done.
| |
| 601 const std::vector<std::string>& login_input_methods = | |
| 602 ime_manager->GetInputMethodUtil()->GetHardwareLoginInputMethodIds(); | |
| 603 ime_manager->ChangeInputMethod(login_input_methods[0]); | |
| 595 } | 604 } |
| 596 | 605 |
| 597 void SetGuestLocale(UserManager* const usermanager, Profile* const profile) { | 606 void SetGuestLocale(UserManager* const usermanager, Profile* const profile) { |
| 598 scoped_ptr<GuestLanguageSetCallbackData> data( | 607 scoped_ptr<GuestLanguageSetCallbackData> data( |
| 599 new GuestLanguageSetCallbackData(profile)); | 608 new GuestLanguageSetCallbackData(profile)); |
| 600 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 609 scoped_ptr<locale_util::SwitchLanguageCallback> callback( |
| 601 new locale_util::SwitchLanguageCallback(base::Bind( | 610 new locale_util::SwitchLanguageCallback(base::Bind( |
| 602 &GuestLanguageSetCallbackData::Callback, base::Passed(data.Pass())))); | 611 &GuestLanguageSetCallbackData::Callback, base::Passed(data.Pass())))); |
| 603 User* const user = usermanager->GetUserByProfile(profile); | 612 User* const user = usermanager->GetUserByProfile(profile); |
| 604 usermanager->RespectLocalePreference(profile, user, callback.Pass()); | 613 usermanager->RespectLocalePreference(profile, user, callback.Pass()); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 826 // Destroy DBus services immediately after threads are stopped. | 835 // Destroy DBus services immediately after threads are stopped. |
| 827 dbus_services_.reset(); | 836 dbus_services_.reset(); |
| 828 | 837 |
| 829 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 838 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 830 | 839 |
| 831 // Destroy DeviceSettingsService after g_browser_process. | 840 // Destroy DeviceSettingsService after g_browser_process. |
| 832 DeviceSettingsService::Shutdown(); | 841 DeviceSettingsService::Shutdown(); |
| 833 } | 842 } |
| 834 | 843 |
| 835 } // namespace chromeos | 844 } // namespace chromeos |
| OLD | NEW |