| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/chromeos/cros/cros_library.h" | 22 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 23 #include "chrome/browser/chromeos/cros/keyboard_library.h" | 23 #include "chrome/browser/chromeos/cros/keyboard_library.h" |
| 24 #include "chrome/browser/chromeos/language_preferences.h" | 24 #include "chrome/browser/chromeos/language_preferences.h" |
| 25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/l10n/l10n_util_collator.h" | 27 #include "ui/base/l10n/l10n_util_collator.h" |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 // Mapping from input method ID to keyboard overlay ID, which specifies the | |
| 32 // layout and the glyphs of the keyboard overlay. | |
| 33 // TODO(mazda): Move this list to whitelist.txt (http://crosbug.com/9682) | |
| 34 const struct InputMethodIdToKeyboardOverlayId { | |
| 35 const char* input_method_id; | |
| 36 const char* keyboard_overlay_id; | |
| 37 } kInputMethodIdToKeyboardOverlayId[] = { | |
| 38 { "xkb:nl::nld", "nl" }, | |
| 39 { "xkb:be::nld", "nl" }, | |
| 40 { "xkb:fr::fra", "fr" }, | |
| 41 { "xkb:be::fra", "fr" }, | |
| 42 { "xkb:ca::fra", "fr_CA" }, | |
| 43 { "xkb:ch:fr:fra", "fr" }, | |
| 44 { "xkb:de::ger", "de" }, | |
| 45 { "xkb:be::ger", "de" }, | |
| 46 { "xkb:ch::ger", "de" }, | |
| 47 { "mozc", "en_US" }, | |
| 48 { "mozc-jp", "ja" }, | |
| 49 { "mozc-dv", "en_US_dvorak" }, | |
| 50 { "xkb:jp::jpn", "ja" }, | |
| 51 { "xkb:ru::rus", "ru" }, | |
| 52 { "xkb:ru:phonetic:rus", "ru" }, | |
| 53 { "m17n:th:kesmanee", "th" }, | |
| 54 { "m17n:th:pattachote", "th" }, | |
| 55 { "m17n:th:tis820", "th" }, | |
| 56 { "chewing", "zh_TW" }, | |
| 57 { "m17n:zh:cangjie", "zh_TW" }, | |
| 58 { "m17n:zh:quick", "zh_TW" }, | |
| 59 { "m17n:vi:tcvn", "vi" }, | |
| 60 { "m17n:vi:telex", "vi" }, | |
| 61 { "m17n:vi:viqr", "vi" }, | |
| 62 { "m17n:vi:vni", "vi" }, | |
| 63 { "xkb:us::eng", "en_US" }, | |
| 64 { "xkb:us:intl:eng", "en_US" }, | |
| 65 { "xkb:us:altgr-intl:eng", "en_US" }, | |
| 66 { "xkb:us:dvorak:eng", "en_US_dvorak" }, | |
| 67 // TODO(mazda): Add keyboard overlay definition for US Colemak. | |
| 68 { "xkb:us:colemak:eng", "en_US" }, | |
| 69 { "hangul", "ko" }, | |
| 70 { "pinyin", "zh_CN" }, | |
| 71 { "m17n:ar:kbd", "ar" }, | |
| 72 { "m17n:hi:itrans", "hi" }, | |
| 73 { "m17n:fa:isiri", "ar" }, | |
| 74 { "xkb:br::por", "pt_BR" }, | |
| 75 { "xkb:bg::bul", "bg" }, | |
| 76 { "xkb:bg:phonetic:bul", "bg" }, | |
| 77 { "xkb:ca:eng:eng", "ca" }, | |
| 78 { "xkb:cz::cze", "cs" }, | |
| 79 { "xkb:ee::est", "et" }, | |
| 80 { "xkb:es::spa", "es" }, | |
| 81 { "xkb:es:cat:cat", "ca" }, | |
| 82 { "xkb:dk::dan", "da" }, | |
| 83 { "xkb:gr::gre", "el" }, | |
| 84 { "xkb:il::heb", "iw" }, | |
| 85 { "xkb:kr:kr104:kor", "ko" }, | |
| 86 { "xkb:latam::spa", "es_419" }, | |
| 87 { "xkb:lt::lit", "lt" }, | |
| 88 { "xkb:lv:apostrophe:lav", "lv" }, | |
| 89 { "xkb:hr::scr", "hr" }, | |
| 90 { "xkb:gb:extd:eng", "en_GB" }, | |
| 91 { "xkb:fi::fin", "fi" }, | |
| 92 { "xkb:hu::hun", "hu" }, | |
| 93 { "xkb:it::ita", "it" }, | |
| 94 { "xkb:no::nob", "no" }, | |
| 95 { "xkb:pl::pol", "pl" }, | |
| 96 { "xkb:pt::por", "pt_PT" }, | |
| 97 { "xkb:ro::rum", "ro" }, | |
| 98 { "xkb:se::swe", "sv" }, | |
| 99 { "xkb:sk::slo", "sk" }, | |
| 100 { "xkb:si::slv", "sl" }, | |
| 101 { "xkb:rs::srp", "sr" }, | |
| 102 { "xkb:tr::tur", "tr" }, | |
| 103 { "xkb:ua::ukr", "uk" }, | |
| 104 }; | |
| 105 | |
| 106 // Map from language code to associated input method IDs, etc. | 31 // Map from language code to associated input method IDs, etc. |
| 107 typedef std::multimap<std::string, std::string> LanguageCodeToIdsMap; | 32 typedef std::multimap<std::string, std::string> LanguageCodeToIdsMap; |
| 108 struct IdMaps { | 33 struct IdMaps { |
| 109 scoped_ptr<LanguageCodeToIdsMap> language_code_to_ids; | 34 scoped_ptr<LanguageCodeToIdsMap> language_code_to_ids; |
| 110 scoped_ptr<std::map<std::string, std::string> > id_to_language_code; | 35 scoped_ptr<std::map<std::string, std::string> > id_to_language_code; |
| 111 scoped_ptr<std::map<std::string, std::string> > id_to_display_name; | 36 scoped_ptr<std::map<std::string, std::string> > id_to_display_name; |
| 112 | 37 |
| 113 // Returns the singleton instance. | 38 // Returns the singleton instance. |
| 114 static IdMaps* GetInstance() { | 39 static IdMaps* GetInstance() { |
| 115 return Singleton<IdMaps>::get(); | 40 return Singleton<IdMaps>::get(); |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 library->ChangeInputMethod(initial_input_method_id); | 599 library->ChangeInputMethod(initial_input_method_id); |
| 675 } | 600 } |
| 676 } | 601 } |
| 677 | 602 |
| 678 void OnLocaleChanged() { | 603 void OnLocaleChanged() { |
| 679 IdMaps::GetInstance()->ReloadMaps(); | 604 IdMaps::GetInstance()->ReloadMaps(); |
| 680 } | 605 } |
| 681 | 606 |
| 682 } // namespace input_method | 607 } // namespace input_method |
| 683 } // namespace chromeos | 608 } // namespace chromeos |
| OLD | NEW |