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 "ash/ime/input_method_menu_item.h" | 9 #include "ash/ime/input_method_menu_item.h" |
10 #include "ash/ime/input_method_menu_manager.h" | 10 #include "ash/ime/input_method_menu_manager.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "ui/base/accelerators/accelerator.h" | 30 #include "ui/base/accelerators/accelerator.h" |
31 | 31 |
32 namespace chromeos { | 32 namespace chromeos { |
33 namespace input_method { | 33 namespace input_method { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 const char nacl_mozc_jp_id[] = | 37 const char nacl_mozc_jp_id[] = |
38 "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_jp"; | 38 "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_jp"; |
39 | 39 |
| 40 const char *kMod3LayoutIds[] = { |
| 41 "xkb:de:neo:ger", |
| 42 "xkb:ca:multix:fra", |
| 43 }; |
| 44 |
| 45 const char *kAltGrLayoutIds[] = { |
| 46 "xkb:be::fra", |
| 47 "xkb:be::ger", |
| 48 "xkb:be::nld", |
| 49 "xkb:bg::bul", |
| 50 "xkb:bg:phonetic:bul", |
| 51 "xkb:br::por", |
| 52 "xkb:ca::fra", |
| 53 "xkb:ca:eng:eng", |
| 54 "xkb:ca:multix:fra", |
| 55 "xkb:ch::ger", |
| 56 "xkb:ch:fr:fra", |
| 57 "xkb:cz::cze", |
| 58 "xkb:de::ger", |
| 59 "xkb:de:neo:ger", |
| 60 "xkb:dk::dan", |
| 61 "xkb:ee::est", |
| 62 "xkb:es::spa", |
| 63 "xkb:es:cat:cat", |
| 64 "xkb:fi::fin", |
| 65 "xkb:fr::fra", |
| 66 "xkb:gb:dvorak:eng", |
| 67 "xkb:gb:extd:eng", |
| 68 "xkb:gr::gre", |
| 69 "xkb:hr::scr", |
| 70 "xkb:il::heb", |
| 71 "xkb:it::ita", |
| 72 "xkb:latam::spa", |
| 73 "xkb:lt::lit", |
| 74 "xkb:no::nob", |
| 75 "xkb:pl::pol", |
| 76 "xkb:pt::por", |
| 77 "xkb:ro::rum", |
| 78 "xkb:se::swe", |
| 79 "xkb:si::slv", |
| 80 "xkb:sk::slo", |
| 81 "xkb:tr::tur", |
| 82 "xkb:ua::ukr", |
| 83 "xkb:us:altgr-intl:eng", |
| 84 "xkb:us:intl:eng", |
| 85 }; |
| 86 |
40 bool Contains(const std::vector<std::string>& container, | 87 bool Contains(const std::vector<std::string>& container, |
41 const std::string& value) { | 88 const std::string& value) { |
42 return std::find(container.begin(), container.end(), value) != | 89 return std::find(container.begin(), container.end(), value) != |
43 container.end(); | 90 container.end(); |
44 } | 91 } |
45 | 92 |
46 } // namespace | 93 } // namespace |
47 | 94 |
48 bool InputMethodManagerImpl::IsLoginKeyboard( | 95 bool InputMethodManagerImpl::IsLoginKeyboard( |
49 const std::string& layout) const { | 96 const std::string& layout) const { |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 ChangeInputMethodInternal(*iter, true); | 740 ChangeInputMethodInternal(*iter, true); |
694 } | 741 } |
695 | 742 |
696 InputMethodDescriptor InputMethodManagerImpl::GetCurrentInputMethod() const { | 743 InputMethodDescriptor InputMethodManagerImpl::GetCurrentInputMethod() const { |
697 if (current_input_method_.id().empty()) | 744 if (current_input_method_.id().empty()) |
698 return InputMethodUtil::GetFallbackInputMethodDescriptor(); | 745 return InputMethodUtil::GetFallbackInputMethodDescriptor(); |
699 | 746 |
700 return current_input_method_; | 747 return current_input_method_; |
701 } | 748 } |
702 | 749 |
| 750 bool InputMethodManagerImpl::IsMod3UsedByCurrentInputMethod() const { |
| 751 for (size_t i = 0; i < arraysize(kMod3LayoutIds); ++i) { |
| 752 if (GetCurrentInputMethod().id() == kMod3LayoutIds[i]) |
| 753 return true; |
| 754 } |
| 755 return false; |
| 756 } |
| 757 |
| 758 bool InputMethodManagerImpl::IsAltGrUsedByCurrentInputMethod() const { |
| 759 for (size_t i = 0; i < arraysize(kAltGrLayoutIds); ++i) { |
| 760 if (GetCurrentInputMethod().id() == kAltGrLayoutIds[i]) |
| 761 return true; |
| 762 } |
| 763 return false; |
| 764 } |
| 765 |
703 XKeyboard* InputMethodManagerImpl::GetXKeyboard() { | 766 XKeyboard* InputMethodManagerImpl::GetXKeyboard() { |
704 return xkeyboard_.get(); | 767 return xkeyboard_.get(); |
705 } | 768 } |
706 | 769 |
707 InputMethodUtil* InputMethodManagerImpl::GetInputMethodUtil() { | 770 InputMethodUtil* InputMethodManagerImpl::GetInputMethodUtil() { |
708 return &util_; | 771 return &util_; |
709 } | 772 } |
710 | 773 |
711 ComponentExtensionIMEManager* | 774 ComponentExtensionIMEManager* |
712 InputMethodManagerImpl::GetComponentExtensionIMEManager() { | 775 InputMethodManagerImpl::GetComponentExtensionIMEManager() { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 if (candidate_window_controller_.get()) | 898 if (candidate_window_controller_.get()) |
836 return; | 899 return; |
837 | 900 |
838 candidate_window_controller_.reset( | 901 candidate_window_controller_.reset( |
839 CandidateWindowController::CreateCandidateWindowController()); | 902 CandidateWindowController::CreateCandidateWindowController()); |
840 candidate_window_controller_->AddObserver(this); | 903 candidate_window_controller_->AddObserver(this); |
841 } | 904 } |
842 | 905 |
843 } // namespace input_method | 906 } // namespace input_method |
844 } // namespace chromeos | 907 } // namespace chromeos |
OLD | NEW |