| Index: chrome/browser/chromeos/input_method/input_method_manager_impl.cc
|
| diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
|
| index 0b710197fe7f61bc274c1b28af164e265b91c07b..79e428ab45c331b19043f7a8d58429b63d27bba1 100644
|
| --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
|
| +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
|
| @@ -43,9 +43,7 @@ bool Contains(const std::vector<std::string>& container,
|
|
|
| bool InputMethodManagerImpl::IsLoginKeyboard(
|
| const std::string& layout) const {
|
| - const InputMethodDescriptor* ime =
|
| - util_.GetInputMethodDescriptorFromId(layout);
|
| - return ime ? ime->is_login_keyboard() : false;
|
| + return util_.IsLoginKeyboard(layout);
|
| }
|
|
|
| InputMethodManagerImpl::InputMethodManagerImpl(
|
| @@ -147,7 +145,8 @@ size_t InputMethodManagerImpl::GetNumActiveInputMethods() const {
|
| }
|
|
|
| void InputMethodManagerImpl::EnableLayouts(const std::string& language_code,
|
| - const std::string& initial_layout) {
|
| + const std::string& initial_layout,
|
| + const bool login_layouts_only) {
|
| if (state_ == STATE_TERMINATING)
|
| return;
|
|
|
| @@ -158,15 +157,19 @@ void InputMethodManagerImpl::EnableLayouts(const std::string& language_code,
|
| &candidates);
|
| // Add the hardware keyboard as well. We should always add this so users
|
| // can use the hardware keyboard on the login screen and the screen locker.
|
| - candidates.push_back(util_.GetHardwareInputMethodId());
|
| + candidates.push_back(util_.GetHardwareLoginInputMethodId());
|
|
|
| std::vector<std::string> layouts;
|
| // First, add the initial input method ID, if it's requested, to
|
| // layouts, so it appears first on the list of active input
|
| // methods at the input language status menu.
|
| - if (util_.IsValidInputMethodId(initial_layout) &&
|
| - IsLoginKeyboard(initial_layout)) {
|
| - layouts.push_back(initial_layout);
|
| + if (util_.IsValidInputMethodId(initial_layout)) {
|
| + if (login_layouts_only && !IsLoginKeyboard(initial_layout)) {
|
| + DVLOG(1) << "EnableLayouts: ignoring non-login initial keyboard layout:"
|
| + << initial_layout;
|
| + } else {
|
| + layouts.push_back(initial_layout);
|
| + }
|
| } else if (!initial_layout.empty()) {
|
| DVLOG(1) << "EnableLayouts: ignoring non-keyboard or invalid ID: "
|
| << initial_layout;
|
| @@ -177,7 +180,8 @@ void InputMethodManagerImpl::EnableLayouts(const std::string& language_code,
|
| const std::string& candidate = candidates[i];
|
| // Not efficient, but should be fine, as the two vectors are very
|
| // short (2-5 items).
|
| - if (!Contains(layouts, candidate) && IsLoginKeyboard(candidate))
|
| + if (!Contains(layouts, candidate) &&
|
| + (!login_layouts_only || IsLoginKeyboard(candidate)))
|
| layouts.push_back(candidate);
|
| }
|
|
|
| @@ -537,7 +541,8 @@ void InputMethodManagerImpl::SetInputMethodDefault() {
|
| initial_input_method_id =
|
| GetInputMethodUtil()->GetHardwareInputMethodId();
|
| }
|
| - EnableLayouts(locale, initial_input_method_id);
|
| + EnableLayouts(
|
| + locale, initial_input_method_id, true /* login_layouts_only */);
|
| }
|
| }
|
|
|
|
|