OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/ime/extension_ime_util.h" | 5 #include "chromeos/ime/extension_ime_util.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 | 8 |
9 namespace chromeos { | 9 namespace chromeos { |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 | 110 |
111 bool IsMemberOfExtension(const std::string& input_method_id, | 111 bool IsMemberOfExtension(const std::string& input_method_id, |
112 const std::string& extension_id) { | 112 const std::string& extension_id) { |
113 return StartsWithASCII(input_method_id, | 113 return StartsWithASCII(input_method_id, |
114 kExtensionIMEPrefix + extension_id, | 114 kExtensionIMEPrefix + extension_id, |
115 true /* Case sensitive */); | 115 true /* Case sensitive */); |
116 } | 116 } |
117 | 117 |
118 bool IsKeyboardLayoutExtension(const std::string& input_method_id) { | 118 bool IsKeyboardLayoutExtension(const std::string& input_method_id) { |
119 std::string prefix = kComponentExtensionIMEPrefix; | 119 if (IsComponentExtensionIME(input_method_id)) |
120 return StartsWithASCII(input_method_id, prefix + kXkbExtensionId, true); | 120 return StartsWithASCII(GetComponentIDByInputMethodID(input_method_id), |
| 121 "xkb:", true); |
| 122 return false; |
121 } | 123 } |
122 | 124 |
123 std::string MaybeGetLegacyXkbId(const std::string& input_method_id) { | 125 std::string MaybeGetLegacyXkbId(const std::string& input_method_id) { |
124 if (IsKeyboardLayoutExtension(input_method_id)) | 126 if (IsKeyboardLayoutExtension(input_method_id)) |
125 return GetComponentIDByInputMethodID(input_method_id); | 127 return GetComponentIDByInputMethodID(input_method_id); |
126 return input_method_id; | 128 return input_method_id; |
127 } | 129 } |
128 | 130 |
129 } // namespace extension_ime_util | 131 } // namespace extension_ime_util |
130 } // namespace chromeos | 132 } // namespace chromeos |
OLD | NEW |