Chromium Code Reviews| Index: chromeos/ime/extension_ime_util.cc |
| diff --git a/chromeos/ime/extension_ime_util.cc b/chromeos/ime/extension_ime_util.cc |
| index 474622df28773e9271c9baf3501457eceb6b5ca1..ab1354183bd498a716531d1b4141e2954a9c394c 100644 |
| --- a/chromeos/ime/extension_ime_util.cc |
| +++ b/chromeos/ime/extension_ime_util.cc |
| @@ -110,12 +110,24 @@ bool IsKeyboardLayoutExtension(const std::string& input_method_id) { |
| return StartsWithASCII(input_method_id, prefix + kXkbExtensionId, true); |
| } |
| -std::string MaybeGetLegacyXkbId(const std::string& input_method_id) { |
| - if (IsKeyboardLayoutExtension(input_method_id)) { |
| - size_t pos = input_method_id.find("xkb:"); |
| - if (pos != std::string::npos) |
| +std::string GetEngineIDByInputMethodID(const std::string& input_method_id) { |
| + if (!IsComponentExtensionIME(input_method_id)) |
| + return input_method_id; |
| + |
|
Shu Chen
2014/07/02 02:29:04
just do:
return input_method_id.substr(kComponent
michaelpg
2014/07/10 00:46:01
Done.
|
| + size_t pos = std::string::npos; |
| + if (IsKeyboardLayoutExtension(input_method_id)) |
| + pos = input_method_id.find("xkb:"); |
| + else |
| + pos = input_method_id.find(kComponentExtensionIMEPrefix); |
| + |
| + if (pos != std::string::npos) |
| return input_method_id.substr(pos); |
| - } |
| + return input_method_id; |
| +} |
| + |
| +std::string MaybeGetLegacyXkbId(const std::string& input_method_id) { |
| + if (IsKeyboardLayoutExtension(input_method_id)) |
| + return GetEngineIDByInputMethodID(input_method_id); |
| return input_method_id; |
| } |