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

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

Issue 18001004: Remove Hangul IME with migration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update Tests: Remove Ko/Kr entry and mozc-hangul Created 7 years, 5 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 | Annotate | Revision Log
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_manager_impl.h" 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h"
6 6
7 #include <algorithm> // std::find 7 #include <algorithm> // std::find
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 { "m17n:mr:itrans", 90 { "m17n:mr:itrans",
91 "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_deva_phone-" }, 91 "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_deva_phone-" },
92 { "m17n:te:itrans", 92 { "m17n:te:itrans",
93 "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_te_phone" }, 93 "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_te_phone" },
94 { "m17n:fa:isiri", "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_fa" }, 94 { "m17n:fa:isiri", "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_fa" },
95 // TODO(nona): Remove following migration map in M32 95 // TODO(nona): Remove following migration map in M32
96 { "m17n:zh:quick", 96 { "m17n:zh:quick",
97 "_comp_ime_ekbifjdfhkmdeeajnolmgdlmkllopefizh-hant-t-i0-und" }, 97 "_comp_ime_ekbifjdfhkmdeeajnolmgdlmkllopefizh-hant-t-i0-und" },
98 }; 98 };
99 99
100 const struct MigrationHangulKeyboardToInputMethodID {
101 const char* keyboard_id;
102 const char* ime_id;
103 } kMigrationHangulKeyboardToInputMethodID[] = {
104 { "2", "_comp_ime_bdgdidmhaijohebebipajioienkglgfohangul_2set" },
105 { "3f", "_comp_ime_bdgdidmhaijohebebipajioienkglgfohangul_3setfinal" },
106 { "39", "_comp_ime_bdgdidmhaijohebebipajioienkglgfohangul_3set390" },
107 { "3s", "_comp_ime_bdgdidmhaijohebebipajioienkglgfohangul_3setnoshift" },
108 { "ro", "_comp_ime_bdgdidmhaijohebebipajioienkglgfohangul_romaja" },
109 };
110
100 } // namespace 111 } // namespace
101 112
102 InputMethodManagerImpl::InputMethodManagerImpl( 113 InputMethodManagerImpl::InputMethodManagerImpl(
103 scoped_ptr<InputMethodDelegate> delegate) 114 scoped_ptr<InputMethodDelegate> delegate)
104 : delegate_(delegate.Pass()), 115 : delegate_(delegate.Pass()),
105 state_(STATE_LOGIN_SCREEN), 116 state_(STATE_LOGIN_SCREEN),
106 util_(delegate_.get(), GetSupportedInputMethods()), 117 util_(delegate_.get(), GetSupportedInputMethods()),
107 component_extension_ime_manager_(new ComponentExtensionIMEManager()), 118 component_extension_ime_manager_(new ComponentExtensionIMEManager()),
108 weak_ptr_factory_(this) { 119 weak_ptr_factory_(this) {
109 IBusDaemonController::GetInstance()->AddObserver(this); 120 IBusDaemonController::GetInstance()->AddObserver(this);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 rewritten = true; 311 rewritten = true;
301 } 312 }
302 } 313 }
303 } 314 }
304 std::vector<std::string>::iterator it = 315 std::vector<std::string>::iterator it =
305 std::unique(input_method_ids->begin(), input_method_ids->end()); 316 std::unique(input_method_ids->begin(), input_method_ids->end());
306 input_method_ids->resize(std::distance(input_method_ids->begin(), it)); 317 input_method_ids->resize(std::distance(input_method_ids->begin(), it));
307 return rewritten; 318 return rewritten;
308 } 319 }
309 320
321 bool InputMethodManagerImpl::MigrateKoreanKeyboard(
322 const std::string& keyboard_id,
323 std::vector<std::string>* input_method_ids) {
324 std::vector<std::string>::iterator it =
325 std::find(active_input_method_ids_.begin(),
326 active_input_method_ids_.end(),
327 "mozc-hangul");
328 if (it == active_input_method_ids_.end())
329 return false;
330
331 for (size_t i = 0;
332 i < ARRAYSIZE_UNSAFE(kMigrationHangulKeyboardToInputMethodID); ++i) {
333 if (kMigrationHangulKeyboardToInputMethodID[i].keyboard_id == keyboard_id) {
334 *it = kMigrationHangulKeyboardToInputMethodID[i].ime_id;
335 input_method_ids->assign(active_input_method_ids_.begin(),
336 active_input_method_ids_.end());
337 return true;
338 }
339 }
340 return false;
341 }
342
310 bool InputMethodManagerImpl::SetInputMethodConfig( 343 bool InputMethodManagerImpl::SetInputMethodConfig(
311 const std::string& section, 344 const std::string& section,
312 const std::string& config_name, 345 const std::string& config_name,
313 const InputMethodConfigValue& value) { 346 const InputMethodConfigValue& value) {
314 DCHECK(section != language_prefs::kGeneralSectionName || 347 DCHECK(section != language_prefs::kGeneralSectionName ||
315 config_name != language_prefs::kPreloadEnginesConfigName); 348 config_name != language_prefs::kPreloadEnginesConfigName);
316 349
317 if (state_ == STATE_TERMINATING) 350 if (state_ == STATE_TERMINATING)
318 return false; 351 return false;
352
319 return ibus_controller_->SetInputMethodConfig(section, config_name, value); 353 return ibus_controller_->SetInputMethodConfig(section, config_name, value);
320 } 354 }
321 355
322 void InputMethodManagerImpl::ChangeInputMethod( 356 void InputMethodManagerImpl::ChangeInputMethod(
323 const std::string& input_method_id) { 357 const std::string& input_method_id) {
324 ChangeInputMethodInternal(input_method_id, false); 358 ChangeInputMethodInternal(input_method_id, false);
325 } 359 }
326 360
327 bool InputMethodManagerImpl::ChangeInputMethodInternal( 361 bool InputMethodManagerImpl::ChangeInputMethodInternal(
328 const std::string& input_method_id, 362 const std::string& input_method_id,
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 input_method_ids_to_switch.push_back(nacl_mozc_jp_id); 707 input_method_ids_to_switch.push_back(nacl_mozc_jp_id);
674 break; 708 break;
675 case ui::VKEY_NONCONVERT: // Muhenkan key on JP106 keyboard 709 case ui::VKEY_NONCONVERT: // Muhenkan key on JP106 keyboard
676 input_method_ids_to_switch.push_back("xkb:jp::jpn"); 710 input_method_ids_to_switch.push_back("xkb:jp::jpn");
677 break; 711 break;
678 case ui::VKEY_DBE_SBCSCHAR: // ZenkakuHankaku key on JP106 keyboard 712 case ui::VKEY_DBE_SBCSCHAR: // ZenkakuHankaku key on JP106 keyboard
679 case ui::VKEY_DBE_DBCSCHAR: 713 case ui::VKEY_DBE_DBCSCHAR:
680 input_method_ids_to_switch.push_back(nacl_mozc_jp_id); 714 input_method_ids_to_switch.push_back(nacl_mozc_jp_id);
681 input_method_ids_to_switch.push_back("xkb:jp::jpn"); 715 input_method_ids_to_switch.push_back("xkb:jp::jpn");
682 break; 716 break;
683 case ui::VKEY_HANGUL: // Hangul (or right Alt) key on Korean keyboard
684 input_method_ids_to_switch.push_back("mozc-hangul");
685 input_method_ids_to_switch.push_back("xkb:kr:kr104:kor");
686 break;
687 default: 717 default:
688 NOTREACHED(); 718 NOTREACHED();
689 break; 719 break;
690 } 720 }
691 if (input_method_ids_to_switch.empty()) { 721 if (input_method_ids_to_switch.empty()) {
692 DVLOG(1) << "Unexpected VKEY: " << accelerator.key_code(); 722 DVLOG(1) << "Unexpected VKEY: " << accelerator.key_code();
693 return false; 723 return false;
694 } 724 }
695 725
696 // Obtain the intersection of input_method_ids_to_switch and 726 // Obtain the intersection of input_method_ids_to_switch and
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 else 938 else
909 DVLOG(1) << "Failed to initialize the candidate window controller"; 939 DVLOG(1) << "Failed to initialize the candidate window controller";
910 } 940 }
911 941
912 bool InputMethodManagerImpl::IsIBusConnectionAlive() { 942 bool InputMethodManagerImpl::IsIBusConnectionAlive() {
913 return DBusThreadManager::Get() && DBusThreadManager::Get()->GetIBusClient(); 943 return DBusThreadManager::Get() && DBusThreadManager::Get()->GetIBusClient();
914 } 944 }
915 945
916 } // namespace input_method 946 } // namespace input_method
917 } // namespace chromeos 947 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698