| 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..b5c3fb4cb1eef9e0ac596714b2c5516688f2fb24 100644
|
| --- a/chrome/browser/chromeos/input_method/input_method_util.cc
|
| +++ b/chrome/browser/chromeos/input_method/input_method_util.cc
|
| @@ -611,11 +611,40 @@ std::string InputMethodUtil::GetLanguageDefaultInputMethodId(
|
| return std::string();
|
| }
|
|
|
| +bool InputMethodUtil::MigrateXkbInputMethods(
|
| + std::vector<std::string>* input_method_ids) {
|
| + bool rewritten = false;
|
| + std::vector<std::string>& ids = *input_method_ids;
|
| + for (size_t i = 0; i < ids.size(); ++i) {
|
| + std::string id =
|
| + extension_ime_util::GetInputMethodIDByKeyboardLayout(ids[i]);
|
| + if (id != ids[i]) {
|
| + ids[i] = id;
|
| + rewritten = true;
|
| + }
|
| + }
|
| + if (rewritten) {
|
| + // Removes the duplicates.
|
| + size_t t = 0, j = 0;
|
| + for (size_t i = 0; i < ids.size(); ++i) {
|
| + for (j = 0; j < t; ++j) {
|
| + if (ids[i] == ids[j])
|
| + break;
|
| + }
|
| + if (t == j) // no dup.
|
| + ids[t++] = ids[i];
|
| + }
|
| + ids.resize(t);
|
| + }
|
| + 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 +711,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() {
|
|
|