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 namespace { | 10 namespace { |
11 const char kExtensionIMEPrefix[] = "_ext_ime_"; | 11 const char kExtensionIMEPrefix[] = "_ext_ime_"; |
12 const int kExtensionIMEPrefixLength = | 12 const int kExtensionIMEPrefixLength = |
13 sizeof(kExtensionIMEPrefix) / sizeof(kExtensionIMEPrefix[0]) - 1; | 13 sizeof(kExtensionIMEPrefix) / sizeof(kExtensionIMEPrefix[0]) - 1; |
14 const char kComponentExtensionIMEPrefix[] = "_comp_ime_"; | 14 const char kComponentExtensionIMEPrefix[] = "_comp_ime_"; |
| 15 const char kExtensionXkbIdPrefix[] = |
| 16 "_comp_ime_fgoepimhcoialccpbmpnnblemnepkkao"; |
15 const int kComponentExtensionIMEPrefixLength = | 17 const int kComponentExtensionIMEPrefixLength = |
16 sizeof(kComponentExtensionIMEPrefix) / | 18 sizeof(kComponentExtensionIMEPrefix) / |
17 sizeof(kComponentExtensionIMEPrefix[0]) - 1; | 19 sizeof(kComponentExtensionIMEPrefix[0]) - 1; |
18 const int kExtensionIdLength = 32; | 20 const int kExtensionIdLength = 32; |
19 } // namespace | 21 } // namespace |
20 | 22 |
21 namespace extension_ime_util { | 23 namespace extension_ime_util { |
22 std::string GetInputMethodID(const std::string& extension_id, | 24 std::string GetInputMethodID(const std::string& extension_id, |
23 const std::string& engine_id) { | 25 const std::string& engine_id) { |
24 DCHECK(!extension_id.empty()); | 26 DCHECK(!extension_id.empty()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 true); // Case sensitive. | 64 true); // Case sensitive. |
63 } | 65 } |
64 | 66 |
65 bool IsMemberOfExtension(const std::string& input_method_id, | 67 bool IsMemberOfExtension(const std::string& input_method_id, |
66 const std::string& extension_id) { | 68 const std::string& extension_id) { |
67 return StartsWithASCII(input_method_id, | 69 return StartsWithASCII(input_method_id, |
68 kExtensionIMEPrefix + extension_id, | 70 kExtensionIMEPrefix + extension_id, |
69 true); // Case sensitive. | 71 true); // Case sensitive. |
70 } | 72 } |
71 | 73 |
| 74 bool IsKeyboardLayoutExtension(const std::string& input_method_id) { |
| 75 return StartsWithASCII(input_method_id, kExtensionXkbIdPrefix, true); |
| 76 } |
| 77 |
72 } // namespace extension_ime_util | 78 } // namespace extension_ime_util |
73 } // namespace chromeos | 79 } // namespace chromeos |
OLD | NEW |