OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/input_method/input_method_util.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // To distinguish from "xkb:gb::eng" | 42 // To distinguish from "xkb:gb::eng" |
43 { "xkb:gb:dvorak:eng", "DV" }, | 43 { "xkb:gb:dvorak:eng", "DV" }, |
44 // To distinguish from "xkb:jp::jpn" | 44 // To distinguish from "xkb:jp::jpn" |
45 // TODO(nona): Make following variables configurable. http://crbug.com/232260. | 45 // TODO(nona): Make following variables configurable. http://crbug.com/232260. |
46 { "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_us", "\xe3\x81\x82" }, | 46 { "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_us", "\xe3\x81\x82" }, |
47 { "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_jp", "\xe3\x81\x82" }, | 47 { "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_jp", "\xe3\x81\x82" }, |
48 { "_comp_ime_bbaiamgfapehflhememkfglaehiobjnknacl_mozc_us", "\xe3\x81\x82" }, | 48 { "_comp_ime_bbaiamgfapehflhememkfglaehiobjnknacl_mozc_us", "\xe3\x81\x82" }, |
49 { "_comp_ime_bbaiamgfapehflhememkfglaehiobjnknacl_mozc_jp", "\xe3\x81\x82" }, | 49 { "_comp_ime_bbaiamgfapehflhememkfglaehiobjnknacl_mozc_jp", "\xe3\x81\x82" }, |
50 // For simplified Chinese input methods | 50 // For simplified Chinese input methods |
51 { "pinyin", "\xe6\x8b\xbc" }, // U+62FC | 51 { "pinyin", "\xe6\x8b\xbc" }, // U+62FC |
| 52 { "_comp_ime_cpgalbafkoofkjmaeonnfijgpfennjjnzh-t-i0-pinyin", |
| 53 "\xe6\x8b\xbc" }, |
| 54 { "_comp_ime_nmblnjkfdkabgdofidlkienfnnbjhnabzh-t-i0-pinyin", |
| 55 "\xe6\x8b\xbc" }, |
52 { "pinyin-dv", "\xe6\x8b\xbc" }, | 56 { "pinyin-dv", "\xe6\x8b\xbc" }, |
53 // For traditional Chinese input methods | 57 // For traditional Chinese input methods |
54 { "mozc-chewing", "\xe9\x85\xb7" }, // U+9177 | 58 { "mozc-chewing", "\xe9\x85\xb7" }, // U+9177 |
| 59 { "_comp_ime_ekbifjdfhkmdeeajnolmgdlmkllopefizh-hant-t-i0-und", |
| 60 "\xe9\x85\xb7" }, // U+9177 |
| 61 { "_comp_ime_goedamlknlnjaengojinmfgpmdjmkooozh-hant-t-i0-und", |
| 62 "\xe9\x85\xb7" }, // U+9177 |
55 { "m17n:zh:cangjie", "\xe5\x80\x89" }, // U+5009 | 63 { "m17n:zh:cangjie", "\xe5\x80\x89" }, // U+5009 |
| 64 { "_comp_ime_aeebooiibjahgpgmhkeocbeekccfknbjzh-hant-t-i0-cangjie-1987", |
| 65 "\xe5\x80\x89" }, // U+5009 |
| 66 { "_comp_ime_gjhclobljhjhgoebiipblnmdodbmpdgdzh-hant-t-i0-cangjie-1987", |
| 67 "\xe5\x80\x89" }, // U+5009 |
56 { "m17n:zh:quick", "\xe9\x80\x9f" }, // U+901F | 68 { "m17n:zh:quick", "\xe9\x80\x9f" }, // U+901F |
57 // For Hangul input method. | 69 // For Hangul input method. |
58 { "mozc-hangul", "\xed\x95\x9c" }, // U+D55C | 70 { "mozc-hangul", "\xed\x95\x9c" }, // U+D55C |
59 }; | 71 }; |
60 | 72 |
61 const size_t kMappingFromIdToIndicatorTextLen = | 73 const size_t kMappingFromIdToIndicatorTextLen = |
62 ARRAYSIZE_UNSAFE(kMappingFromIdToIndicatorText); | 74 ARRAYSIZE_UNSAFE(kMappingFromIdToIndicatorText); |
63 | 75 |
64 // A mapping from an input method id to a resource id for a | 76 // A mapping from an input method id to a resource id for a |
65 // medium length language indicator. | 77 // medium length language indicator. |
66 // For those languages that want to display a slightly longer text in the | 78 // For those languages that want to display a slightly longer text in the |
67 // "Your input method has changed to..." bubble than in the status tray. | 79 // "Your input method has changed to..." bubble than in the status tray. |
68 // If an entry is not found in this table the short name is used. | 80 // If an entry is not found in this table the short name is used. |
69 const struct { | 81 const struct { |
70 const char* input_method_id; | 82 const char* input_method_id; |
71 const int resource_id; | 83 const int resource_id; |
72 } kMappingImeIdToMediumLenNameResourceId[] = { | 84 } kMappingImeIdToMediumLenNameResourceId[] = { |
73 { "m17n:zh:cangjie", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, | 85 { "m17n:zh:cangjie", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, |
74 { "m17n:zh:quick", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, | 86 { "m17n:zh:quick", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, |
75 { "mozc-chewing", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, | 87 { "mozc-chewing", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, |
76 { "mozc-hangul", IDS_LANGUAGES_MEDIUM_LEN_NAME_KOREAN }, | 88 { "mozc-hangul", IDS_LANGUAGES_MEDIUM_LEN_NAME_KOREAN }, |
77 { "pinyin", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_SIMPLIFIED }, | 89 { "pinyin", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_SIMPLIFIED }, |
78 { "pinyin-dv", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_SIMPLIFIED }, | 90 { "pinyin-dv", IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_SIMPLIFIED }, |
| 91 { "_comp_ime_cpgalbafkoofkjmaeonnfijgpfennjjnzh-t-i0-pinyin", |
| 92 IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_SIMPLIFIED}, |
| 93 { "_comp_ime_nmblnjkfdkabgdofidlkienfnnbjhnabzh-t-i0-pinyin", |
| 94 IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_SIMPLIFIED }, |
| 95 { "_comp_ime_ekbifjdfhkmdeeajnolmgdlmkllopefizh-hant-t-i0-und", |
| 96 IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, |
| 97 { "_comp_ime_goedamlknlnjaengojinmfgpmdjmkooozh-hant-t-i0-und", |
| 98 IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, |
| 99 { "_comp_ime_aeebooiibjahgpgmhkeocbeekccfknbjzh-hant-t-i0-cangjie-1987", |
| 100 IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, |
| 101 { "_comp_ime_gjhclobljhjhgoebiipblnmdodbmpdgdzh-hant-t-i0-cangjie-1987", |
| 102 IDS_LANGUAGES_MEDIUM_LEN_NAME_CHINESE_TRADITIONAL }, |
79 }; | 103 }; |
80 const size_t kMappingImeIdToMediumLenNameResourceIdLen = | 104 const size_t kMappingImeIdToMediumLenNameResourceIdLen = |
81 ARRAYSIZE_UNSAFE(kMappingImeIdToMediumLenNameResourceId); | 105 ARRAYSIZE_UNSAFE(kMappingImeIdToMediumLenNameResourceId); |
82 | 106 |
83 // Due to asynchronous initialization of component extension manager, | 107 // Due to asynchronous initialization of component extension manager, |
84 // GetFirstLogingInputMethodIds may miss component extension IMEs. To enable | 108 // GetFirstLogingInputMethodIds may miss component extension IMEs. To enable |
85 // component extension IME as the first loging input method, we have to prepare | 109 // component extension IME as the first loging input method, we have to prepare |
86 // component extension IME IDs. | 110 // component extension IME IDs. |
87 const struct { | 111 const struct { |
88 const char* locale; | 112 const char* locale; |
89 const char* layout; | 113 const char* layout; |
90 const char* input_method_id; | 114 const char* input_method_id; |
91 } kDefaultInputMethodRecommendation[] = { | 115 } kDefaultInputMethodRecommendation[] = { |
92 { "ja", "us", "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_us" }, | 116 { "ja", "us", "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_us" }, |
93 { "ja", "jp", "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_jp" }, | 117 { "ja", "jp", "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_jp" }, |
| 118 { "zh-CN", "us", "_comp_ime_nmblnjkfdkabgdofidlkienfnnbjhnabzh-t-i0-pinyin" }, |
| 119 { "zh-TW", "us", |
| 120 "_comp_ime_goedamlknlnjaengojinmfgpmdjmkooozh-hant-t-i0-und" }, |
94 }; | 121 }; |
95 | 122 |
96 } // namespace | 123 } // namespace |
97 | 124 |
98 namespace chromeos { | 125 namespace chromeos { |
99 | 126 |
100 extern const char* kExtensionImePrefix; | 127 extern const char* kExtensionImePrefix; |
101 | 128 |
102 namespace input_method { | 129 namespace input_method { |
103 | 130 |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 if (iter != id_to_descriptor_.end()) { | 712 if (iter != id_to_descriptor_.end()) { |
686 const InputMethodDescriptor& input_method = iter->second; | 713 const InputMethodDescriptor& input_method = iter->second; |
687 language_code_to_ids_.insert( | 714 language_code_to_ids_.insert( |
688 std::make_pair(language_code, input_method.id())); | 715 std::make_pair(language_code, input_method.id())); |
689 } | 716 } |
690 } | 717 } |
691 } | 718 } |
692 | 719 |
693 } // namespace input_method | 720 } // namespace input_method |
694 } // namespace chromeos | 721 } // namespace chromeos |
OLD | NEW |