diff options
Diffstat (limited to 'chrome')
6 files changed, 18 insertions, 14 deletions
diff --git a/chrome/browser/chromeos/cros/input_method_library.cc b/chrome/browser/chromeos/cros/input_method_library.cc index 42f56d8..f988f8f 100644 --- a/chrome/browser/chromeos/cros/input_method_library.cc +++ b/chrome/browser/chromeos/cros/input_method_library.cc @@ -65,8 +65,10 @@ class InputMethodLibraryImpl : public InputMethodLibrary, ibus_daemon_process_id_(0), initialized_successfully_(false), candidate_window_controller_(NULL) { - current_input_method_ = - input_method::GetHardwareInputMethodDescriptor(); + // Here, we use the fallback input method descriptor but + // |current_input_method_| will be updated as soon as the login screen + // is shown or the user is logged in, so there is no problem. + current_input_method_ = input_method::GetFallbackInputMethodDescriptor(); active_input_method_ids_.push_back(current_input_method_.id); // Observe APP_TERMINATING to stop input method daemon gracefully. // We should not use APP_EXITING here since logout might be canceled by @@ -134,8 +136,11 @@ class InputMethodLibraryImpl : public InputMethodLibrary, LOG(ERROR) << "Descriptor is not found for: " << input_method_id; } } + // This shouldn't happen as there should be at least one active input + // method, but just in case. if (result->empty()) { - result->push_back(input_method::GetHardwareInputMethodDescriptor()); + LOG(ERROR) << "No active input methods found."; + result->push_back(input_method::GetFallbackInputMethodDescriptor()); } return result; } @@ -147,10 +152,10 @@ class InputMethodLibraryImpl : public InputMethodLibrary, virtual InputMethodDescriptors* GetSupportedInputMethods() { if (!initialized_successfully_) { - // If initialization was failed, return the hardware input method, + // If initialization was failed, return the fallback input method, // as this function is guaranteed to return at least one descriptor. InputMethodDescriptors* result = new InputMethodDescriptors; - result->push_back(input_method::GetHardwareInputMethodDescriptor()); + result->push_back(input_method::GetFallbackInputMethodDescriptor()); return result; } diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc index 1b857e2..405f381 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.cc +++ b/chrome/browser/chromeos/input_method/input_method_util.cc @@ -577,8 +577,7 @@ void EnableInputMethods(const std::string& language_code, InputMethodType type, GetInputMethodIdsFromLanguageCode(language_code, type, &input_method_ids); // Add the hardware keyboard. - const std::string keyboard = - input_method::GetHardwareInputMethodDescriptor().id; + const std::string keyboard = GetHardwareInputMethodId(); if (std::count(input_method_ids.begin(), input_method_ids.end(), keyboard) == 0) { input_method_ids.push_back(keyboard); @@ -599,9 +598,9 @@ void EnableInputMethods(const std::string& language_code, InputMethodType type, } } -InputMethodDescriptor GetHardwareInputMethodDescriptor() { +std::string GetHardwareInputMethodId() { // TODO(satorux): Rework this function. crosbug.com/11528. - return GetFallbackInputMethodDescriptor(); + return GetFallbackInputMethodDescriptor().id; } InputMethodDescriptor GetFallbackInputMethodDescriptor() { diff --git a/chrome/browser/chromeos/input_method/input_method_util.h b/chrome/browser/chromeos/input_method/input_method_util.h index 338d93d..184fa87 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.h +++ b/chrome/browser/chromeos/input_method/input_method_util.h @@ -156,8 +156,8 @@ bool GetInputMethodIdsFromLanguageCode( void EnableInputMethods(const std::string& language_code, InputMethodType type, const std::string& initial_input_method_id); -// Returns the input method descriptor of the hardware keyboard. -InputMethodDescriptor GetHardwareInputMethodDescriptor(); +// Returns the input method ID of the hardware keyboard. +std::string GetHardwareInputMethodId(); // Returns the fallback input method descriptor (the very basic US // keyboard). This function is mostly used for testing, but may be used diff --git a/chrome/browser/chromeos/login/language_switch_menu.cc b/chrome/browser/chromeos/login/language_switch_menu.cc index e222f3e..36db187 100644 --- a/chrome/browser/chromeos/login/language_switch_menu.cc +++ b/chrome/browser/chromeos/login/language_switch_menu.cc @@ -104,7 +104,7 @@ void LanguageSwitchMenu::SwitchLanguage(const std::string& locale) { // new locale. input_method::EnableInputMethods( locale, input_method::kKeyboardLayoutsOnly, - input_method::GetHardwareInputMethodDescriptor().id); + input_method::GetHardwareInputMethodId()); // The following line does not seem to affect locale anyhow. Maybe in // future.. diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc index 80d903b..9314efc 100644 --- a/chrome/browser/chromeos/login/screen_locker.cc +++ b/chrome/browser/chromeos/login/screen_locker.cc @@ -132,7 +132,7 @@ class ScreenLockObserver : public chromeos::ScreenLockLibrary::Observer, library->GetActiveInputMethods()); const std::string hardware_keyboard_id = - chromeos::input_method::GetHardwareInputMethodDescriptor().id; + chromeos::input_method::GetHardwareInputMethodId(); // We'll add the hardware keyboard if it's not included in // |active_input_method_list| so that the user can always use the hardware // keyboard on the screen locker. diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index a5367de..8d86cf7 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc @@ -52,7 +52,7 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { kFallbackInputMethodLocale); prefs->RegisterStringPref( prefs::kLanguagePreloadEngines, - input_method::GetHardwareInputMethodDescriptor().id); + input_method::GetHardwareInputMethodId()); for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) { prefs->RegisterBooleanPref( language_prefs::kChewingBooleanPrefs[i].pref_name, |