Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_util.cc

Issue 560623003: Update the input method ID migration map for new VPD design. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/input_method_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const char* const kExtensionIdMigrationMap[][2] = { 163 const char* const kExtensionIdMigrationMap[][2] = {
164 // Official Japanese IME extension ID. 164 // Official Japanese IME extension ID.
165 {"fpfbhcjppmaeaijcidgiibchfbnhbelj", "gjaehgfemfahhmlgpdfknkhdnemmolop"}, 165 {"fpfbhcjppmaeaijcidgiibchfbnhbelj", "gjaehgfemfahhmlgpdfknkhdnemmolop"},
166 // Official M17n keyboard extension ID. 166 // Official M17n keyboard extension ID.
167 {"habcdindjejkmepknlhkkloncjcpcnbf", "gjaehgfemfahhmlgpdfknkhdnemmolop"}, 167 {"habcdindjejkmepknlhkkloncjcpcnbf", "gjaehgfemfahhmlgpdfknkhdnemmolop"},
168 }; 168 };
169 169
170 // The engine ID map for migration. This migration is for input method IDs from 170 // The engine ID map for migration. This migration is for input method IDs from
171 // VPD so it's NOT a temporary migration. 171 // VPD so it's NOT a temporary migration.
172 const char* const kEngineIdMigrationMap[][2] = { 172 const char* const kEngineIdMigrationMap[][2] = {
173 {"m17n:", "vkd_"}, 173 {"ime:jp:mozc_jp", "nacl_mozc_jp"},
174 {"ime:zh-t:quick", "zh-hant-t-i0-cangjie-1987-x-m0-simplified"}, 174 {"ime:jp:mozc_us", "nacl_mozc_us"},
175 {"ime:zh-t:zhuyin", "zh-hant-t-i0-und"}, 175 {"ime:ko:hangul_2set", "hangul_2set"},
176 {"ime:ko:hangul", "hangul_2set"}, 176 {"ime:ko:hangul", "hangul_2set"},
177 {"ime:ko:hangul_2set", "hangul_2set"}, 177 {"ime:zh-t:array", "zh-hant-t-i0-array-1992"},
178 {"ime:zh-t:cangjie", "zh-hant-t-i0-cangjie-1987"},
179 {"ime:zh-t:dayi", "zh-hant-t-i0-dayi-1988"},
180 {"ime:zh-t:pinyin", "zh-hant-t-i0-pinyin"},
181 {"ime:zh-t:quick", "zh-hant-t-i0-cangjie-1987-x-m0-simplified"},
182 {"ime:zh-t:zhuyin", "zh-hant-t-i0-und"},
183 {"ime:zh:pinyin", "zh-t-i0-pinyin"},
184 {"ime:zh:wubi", "zh-t-i0-wubi-1986"},
185 {"m17n:", "vkd_"},
186 {"t13n:am", "am-t-i0-und"},
187 {"t13n:ar", "ar-t-i0-und"},
188 {"t13n:bn", "bn-t-i0-und"},
189 {"t13n:el", "el-t-i0-und"},
190 {"t13n:fa", "fa-t-i0-und"},
191 {"t13n:gu", "gu-t-i0-und"},
192 {"t13n:he", "he-t-i0-und"},
193 {"t13n:hi", "hi-t-i0-und"},
194 {"t13n:kn", "kn-t-i0-und"},
195 {"t13n:ml", "ml-t-i0-und"},
196 {"t13n:mr", "mr-t-i0-und"},
197 {"t13n:ne", "ne-t-i0-und"},
198 {"t13n:or", "or-t-i0-und"},
199 {"t13n:pa", "pa-t-i0-und"},
200 {"t13n:sa", "sa-t-i0-und"},
201 {"t13n:sr", "sr-t-i0-und"},
202 {"t13n:ta", "ta-t-i0-und"},
203 {"t13n:te", "te-t-i0-und"},
204 {"t13n:ti", "ti-t-i0-und"},
205 {"t13n:ur", "ur-t-i0-und"},
178 }; 206 };
179 207
180 const size_t kExtensionIdLen = 32; 208 const size_t kExtensionIdLen = 32;
181 209
182 const struct EnglishToResouceId { 210 const struct EnglishToResouceId {
183 const char* english_string_from_ibus; 211 const char* english_string_from_ibus;
184 int resource_id; 212 int resource_id;
185 } kEnglishToResourceIdArray[] = { 213 } kEnglishToResourceIdArray[] = {
186 // For xkb-layouts. 214 // For xkb-layouts.
187 { "xkb:am:phonetic:arm", IDS_STATUSBAR_LAYOUT_ARMENIAN_PHONETIC }, 215 { "xkb:am:phonetic:arm", IDS_STATUSBAR_LAYOUT_ARMENIAN_PHONETIC },
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 607
580 bool InputMethodUtil::MigrateInputMethods( 608 bool InputMethodUtil::MigrateInputMethods(
581 std::vector<std::string>* input_method_ids) { 609 std::vector<std::string>* input_method_ids) {
582 bool rewritten = false; 610 bool rewritten = false;
583 std::vector<std::string>& ids = *input_method_ids; 611 std::vector<std::string>& ids = *input_method_ids;
584 for (size_t i = 0; i < ids.size(); ++i) { 612 for (size_t i = 0; i < ids.size(); ++i) {
585 std::string engine_id = ids[i]; 613 std::string engine_id = ids[i];
586 // Migrates some Engine IDs from VPD. 614 // Migrates some Engine IDs from VPD.
587 for (size_t j = 0; j < arraysize(kEngineIdMigrationMap); ++j) { 615 for (size_t j = 0; j < arraysize(kEngineIdMigrationMap); ++j) {
588 size_t pos = engine_id.find(kEngineIdMigrationMap[j][0]); 616 size_t pos = engine_id.find(kEngineIdMigrationMap[j][0]);
589 if (pos == 0) 617 if (pos == 0) {
590 engine_id.replace(pos, strlen(kEngineIdMigrationMap[j][0]), 618 engine_id.replace(0,
591 kExtensionIdMigrationMap[j][1]); 619 strlen(kEngineIdMigrationMap[j][0]),
620 kEngineIdMigrationMap[j][1]);
621 break;
622 }
592 } 623 }
593 std::string id = 624 std::string id =
594 extension_ime_util::GetInputMethodIDByEngineID(engine_id); 625 extension_ime_util::GetInputMethodIDByEngineID(engine_id);
595 // Migrates old ime id's to new ones. 626 // Migrates old ime id's to new ones.
596 for (size_t j = 0; j < arraysize(kExtensionIdMigrationMap); ++j) { 627 for (size_t j = 0; j < arraysize(kExtensionIdMigrationMap); ++j) {
597 size_t pos = id.find(kExtensionIdMigrationMap[j][0]); 628 size_t pos = id.find(kExtensionIdMigrationMap[j][0]);
598 if (pos != std::string::npos) 629 if (pos != std::string::npos)
599 id.replace(pos, kExtensionIdLen, kExtensionIdMigrationMap[j][1]); 630 id.replace(pos, kExtensionIdLen, kExtensionIdMigrationMap[j][1]);
600 if (id != ids[i]) { 631 if (id != ids[i]) {
601 ids[i] = id; 632 ids[i] = id;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 "US", 752 "US",
722 layouts, 753 layouts,
723 languages, 754 languages,
724 true, // login keyboard. 755 true, // login keyboard.
725 GURL(), // options page, not available. 756 GURL(), // options page, not available.
726 GURL()); // input view page, not available. 757 GURL()); // input view page, not available.
727 } 758 }
728 759
729 } // namespace input_method 760 } // namespace input_method
730 } // namespace chromeos 761 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/input_method_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698