Chromium Code Reviews| Index: chrome/browser/chromeos/input_method/input_method_util.cc |
| diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc |
| index e11dd25e34e545c664398cb4c900c5e7b21f1c90..31f30e6b645be444c8f08b199cafde3ebb4eef96 100644 |
| --- a/chrome/browser/chromeos/input_method/input_method_util.cc |
| +++ b/chrome/browser/chromeos/input_method/input_method_util.cc |
| @@ -611,11 +611,26 @@ std::string InputMethodUtil::GetLanguageDefaultInputMethodId( |
| return std::string(); |
| } |
| +bool InputMethodUtil::MigrateXkbInputMethods( |
| + std::vector<std::string>* input_method_ids) { |
| + bool rewritten = false; |
| + for (size_t i = 0; i < input_method_ids->size(); ++i) { |
| + if (IsKeyboardLayout(input_method_ids->at(i))) { |
|
Yuki
2014/02/27 02:40:33
Why at(i)? You already checked the range.
Yuki
2014/02/27 02:40:33
IsKeyboardLayout() returns almost always true does
Shu Chen
2014/02/27 03:12:12
Please notice that Preferences::SetLanguageConfigS
Shu Chen
2014/02/27 03:12:12
Notice that input_method_ids is a pointer: std::ve
|
| + input_method_ids->at(i).assign( |
|
Yuki
2014/02/27 02:40:33
input_method_ids[i] = ...
has the same effect and
Shu Chen
2014/02/27 03:12:12
Notice that input_method_ids is a pointer: std::ve
|
| + extension_ime_util::GetInputMethodIDByKeyboardLayout( |
| + input_method_ids->at(i))); |
| + rewritten = true; |
| + } |
| + } |
| + return rewritten; |
| +} |
| + |
| void InputMethodUtil::UpdateHardwareLayoutCache() { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| hardware_layouts_.clear(); |
| hardware_login_layouts_.clear(); |
| Tokenize(delegate_->GetHardwareKeyboardLayouts(), ",", &hardware_layouts_); |
| + MigrateXkbInputMethods(&hardware_layouts_); |
| for (size_t i = 0; i < hardware_layouts_.size(); ++i) { |
| if (IsLoginKeyboard(hardware_layouts_[i])) |
| @@ -682,14 +697,15 @@ InputMethodDescriptor InputMethodUtil::GetFallbackInputMethodDescriptor() { |
| layouts.push_back("us"); |
| std::vector<std::string> languages; |
| languages.push_back("en-US"); |
| - return InputMethodDescriptor("xkb:us::eng", |
| - "", |
| - "US", |
| - layouts, |
| - languages, |
| - true, // login keyboard. |
| - GURL(), // options page, not available. |
| - GURL()); // input view page, not available. |
| + return InputMethodDescriptor( |
| + extension_ime_util::GetInputMethodIDByKeyboardLayout("xkb:us::eng"), |
| + "", |
| + "US", |
| + layouts, |
| + languages, |
| + true, // login keyboard. |
| + GURL(), // options page, not available. |
| + GURL()); // input view page, not available. |
| } |
| void InputMethodUtil::ReloadInternalMaps() { |