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_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 12 matching lines...) Expand all Loading... |
23 #include "chromeos/ime/input_method_delegate.h" | 23 #include "chromeos/ime/input_method_delegate.h" |
24 #include "chromeos/ime/xkeyboard.h" | 24 #include "chromeos/ime/xkeyboard.h" |
25 #include "third_party/icu/public/common/unicode/uloc.h" | 25 #include "third_party/icu/public/common/unicode/uloc.h" |
26 #include "ui/base/accelerators/accelerator.h" | 26 #include "ui/base/accelerators/accelerator.h" |
27 | 27 |
28 namespace chromeos { | 28 namespace chromeos { |
29 namespace input_method { | 29 namespace input_method { |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
| 33 const char nacl_mozc_us_id[] = |
| 34 "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_us"; |
| 35 const char nacl_mozc_jp_id[] = |
| 36 "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_jp"; |
| 37 |
33 bool Contains(const std::vector<std::string>& container, | 38 bool Contains(const std::vector<std::string>& container, |
34 const std::string& value) { | 39 const std::string& value) { |
35 return std::find(container.begin(), container.end(), value) != | 40 return std::find(container.begin(), container.end(), value) != |
36 container.end(); | 41 container.end(); |
37 } | 42 } |
38 | 43 |
39 } // namespace | 44 } // namespace |
40 | 45 |
41 InputMethodManagerImpl::InputMethodManagerImpl( | 46 InputMethodManagerImpl::InputMethodManagerImpl( |
42 scoped_ptr<InputMethodDelegate> delegate) | 47 scoped_ptr<InputMethodDelegate> delegate) |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 if (active_input_method_ids_.empty()) { | 551 if (active_input_method_ids_.empty()) { |
547 DVLOG(1) << "active input method is empty"; | 552 DVLOG(1) << "active input method is empty"; |
548 return false; | 553 return false; |
549 } | 554 } |
550 | 555 |
551 // Get the list of input method ids for the |accelerator|. For example, get | 556 // Get the list of input method ids for the |accelerator|. For example, get |
552 // { "mozc-hangul", "xkb:kr:kr104:kor" } for ui::VKEY_DBE_SBCSCHAR. | 557 // { "mozc-hangul", "xkb:kr:kr104:kor" } for ui::VKEY_DBE_SBCSCHAR. |
553 std::vector<std::string> input_method_ids_to_switch; | 558 std::vector<std::string> input_method_ids_to_switch; |
554 switch (accelerator.key_code()) { | 559 switch (accelerator.key_code()) { |
555 case ui::VKEY_CONVERT: // Henkan key on JP106 keyboard | 560 case ui::VKEY_CONVERT: // Henkan key on JP106 keyboard |
556 input_method_ids_to_switch.push_back("mozc-jp"); | 561 input_method_ids_to_switch.push_back(nacl_mozc_jp_id); |
557 break; | 562 break; |
558 case ui::VKEY_NONCONVERT: // Muhenkan key on JP106 keyboard | 563 case ui::VKEY_NONCONVERT: // Muhenkan key on JP106 keyboard |
559 input_method_ids_to_switch.push_back("xkb:jp::jpn"); | 564 input_method_ids_to_switch.push_back("xkb:jp::jpn"); |
560 break; | 565 break; |
561 case ui::VKEY_DBE_SBCSCHAR: // ZenkakuHankaku key on JP106 keyboard | 566 case ui::VKEY_DBE_SBCSCHAR: // ZenkakuHankaku key on JP106 keyboard |
562 case ui::VKEY_DBE_DBCSCHAR: | 567 case ui::VKEY_DBE_DBCSCHAR: |
563 input_method_ids_to_switch.push_back("mozc-jp"); | 568 input_method_ids_to_switch.push_back(nacl_mozc_jp_id); |
564 input_method_ids_to_switch.push_back("xkb:jp::jpn"); | 569 input_method_ids_to_switch.push_back("xkb:jp::jpn"); |
565 break; | 570 break; |
566 case ui::VKEY_HANGUL: // Hangul (or right Alt) key on Korean keyboard | 571 case ui::VKEY_HANGUL: // Hangul (or right Alt) key on Korean keyboard |
567 input_method_ids_to_switch.push_back("mozc-hangul"); | 572 input_method_ids_to_switch.push_back("mozc-hangul"); |
568 input_method_ids_to_switch.push_back("xkb:kr:kr104:kor"); | 573 input_method_ids_to_switch.push_back("xkb:kr:kr104:kor"); |
569 break; | 574 break; |
570 default: | 575 default: |
571 NOTREACHED(); | 576 NOTREACHED(); |
572 break; | 577 break; |
573 } | 578 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 candidate_window_controller_.reset( | 793 candidate_window_controller_.reset( |
789 CandidateWindowController::CreateCandidateWindowController()); | 794 CandidateWindowController::CreateCandidateWindowController()); |
790 if (candidate_window_controller_->Init(ibus_controller_.get())) | 795 if (candidate_window_controller_->Init(ibus_controller_.get())) |
791 candidate_window_controller_->AddObserver(this); | 796 candidate_window_controller_->AddObserver(this); |
792 else | 797 else |
793 DVLOG(1) << "Failed to initialize the candidate window controller"; | 798 DVLOG(1) << "Failed to initialize the candidate window controller"; |
794 } | 799 } |
795 | 800 |
796 } // namespace input_method | 801 } // namespace input_method |
797 } // namespace chromeos | 802 } // namespace chromeos |
OLD | NEW |