diff options
author | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 08:43:24 +0000 |
---|---|---|
committer | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 08:43:24 +0000 |
commit | 799b443b0b3a6834b8a04b1e3d41a7f6cd45357c (patch) | |
tree | 3cf04e497025c2db9b28043d097db027dce6174d | |
parent | 1b4a9530d513314e70b01b16e849ec17294b6666 (diff) | |
download | chromium_src-799b443b0b3a6834b8a04b1e3d41a7f6cd45357c.zip chromium_src-799b443b0b3a6834b8a04b1e3d41a7f6cd45357c.tar.gz chromium_src-799b443b0b3a6834b8a04b1e3d41a7f6cd45357c.tar.bz2 |
Extract input_method_whitelist.{h|cc} from c/b/chromeos.
This is the 2nd try of https://codereview.chromium.org/12438012/
It turned out that c/b/chromeos/input_methods/input_methods.txt is also used by chromeos side.
So keeping c/b/chromeos/input_methods/input_methods.txt as is for migration and after change is in chromeos tree, I will remove it.
BUG=164375
TEST=None
TBR=sky
Review URL: https://chromiumcodereview.appspot.com/13042007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191325 0039d316-1c4b-4281-b951-d872f2087c98
16 files changed, 238 insertions, 22 deletions
diff --git a/chrome/browser/chromeos/input_method/ibus_controller_impl.h b/chrome/browser/chromeos/input_method/ibus_controller_impl.h index b27ecb8..ca63e07 100644 --- a/chrome/browser/chromeos/input_method/ibus_controller_impl.h +++ b/chrome/browser/chromeos/input_method/ibus_controller_impl.h @@ -11,9 +11,9 @@ #include "base/process_util.h" #include "base/threading/thread_checker.h" #include "chrome/browser/chromeos/input_method/ibus_controller_base.h" -#include "chrome/browser/chromeos/input_method/input_method_whitelist.h" #include "chromeos/dbus/ibus/ibus_panel_service.h" #include "chromeos/ime/ibus_daemon_controller.h" +#include "chromeos/ime/input_method_whitelist.h" namespace ui { class InputMethodIBus; diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.h b/chrome/browser/chromeos/input_method/input_method_manager_impl.h index 00b67a0..abaae6d 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.h +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.h @@ -15,8 +15,8 @@ #include "chrome/browser/chromeos/input_method/ibus_controller.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" -#include "chrome/browser/chromeos/input_method/input_method_whitelist.h" #include "chromeos/ime/ibus_daemon_controller.h" +#include "chromeos/ime/input_method_whitelist.h" namespace chromeos { class InputMethodEngineIBus; diff --git a/chrome/browser/chromeos/input_method/input_method_util_unittest.cc b/chrome/browser/chromeos/input_method/input_method_util_unittest.cc index 204ff91..04285853 100644 --- a/chrome/browser/chromeos/input_method/input_method_util_unittest.cc +++ b/chrome/browser/chromeos/input_method/input_method_util_unittest.cc @@ -9,7 +9,7 @@ #include "base/memory/scoped_ptr.h" #include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" -#include "chrome/browser/chromeos/input_method/input_method_whitelist.h" +#include "chromeos/ime/input_method_whitelist.h" #include "chromeos/ime/mock_input_method_delegate.h" #include "grit/generated_resources.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/chromeos/input_method/input_methods.txt b/chrome/browser/chromeos/input_method/input_methods.txt index 64774a0..8440fee 100644 --- a/chrome/browser/chromeos/input_method/input_methods.txt +++ b/chrome/browser/chromeos/input_method/input_methods.txt @@ -1,3 +1,4 @@ +# TODO(nona): Remove this file, this is only for migration. # The list of input methods that we support. The input methods metadata is # also defined here. We use this data for the following purposes. # @@ -49,7 +50,7 @@ # and update the following files by running this script. # # * chrome/app/generated_resources.grd -# * chrome/browser/resources/keyboard_overlay_data.js +# * chrome/browser/resources/chromeos/keyboard_overlay_data.js # * chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc # # If you add an XKB layout which depends on X11's Mod3Mask (e.g. Germany Neo2 diff --git a/chrome/browser/chromeos/input_method/mock_input_method_manager.h b/chrome/browser/chromeos/input_method/mock_input_method_manager.h index 141b459..f0b48ef 100644 --- a/chrome/browser/chromeos/input_method/mock_input_method_manager.h +++ b/chrome/browser/chromeos/input_method/mock_input_method_manager.h @@ -7,8 +7,8 @@ #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" -#include "chrome/browser/chromeos/input_method/input_method_whitelist.h" #include "chrome/browser/chromeos/input_method/mock_xkeyboard.h" +#include "chromeos/ime/input_method_whitelist.h" #include "chromeos/ime/mock_input_method_delegate.h" namespace chromeos { diff --git a/chrome/browser/chromeos/input_method/xkeyboard_unittest.cc b/chrome/browser/chromeos/input_method/xkeyboard_unittest.cc index 113e551..22749dd 100644 --- a/chrome/browser/chromeos/input_method/xkeyboard_unittest.cc +++ b/chrome/browser/chromeos/input_method/xkeyboard_unittest.cc @@ -12,7 +12,7 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" -#include "chrome/browser/chromeos/input_method/input_method_whitelist.h" +#include "chromeos/ime/input_method_whitelist.h" #include "chromeos/ime/mock_input_method_delegate.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi index ee12ef2..d8d516a 100644 --- a/chrome/chrome_browser_chromeos.gypi +++ b/chrome/chrome_browser_chromeos.gypi @@ -24,7 +24,6 @@ # TODO(tbarzic): Cleanup this list. 'app/policy/cloud_policy_codegen.gyp:policy', 'browser_extensions', - 'browser/chromeos/input_method/input_method.gyp:gencode', 'browser/performance_monitor/performance_monitor.gyp:performance_monitor', 'cert_logger_proto', 'chrome_resources.gyp:chrome_extra_resources', @@ -50,6 +49,7 @@ '../components/components.gyp:autofill_regexes', '../content/content.gyp:content_browser', '../content/content.gyp:content_common', + '../chromeos/ime/input_method.gyp:gencode', '../crypto/crypto.gyp:crypto', '../dbus/dbus.gyp:dbus', '../device/device.gyp:device_bluetooth', @@ -349,8 +349,6 @@ 'browser/chromeos/input_method/input_method_util.h', 'browser/chromeos/input_method/component_extension_ime_manager_impl.cc', 'browser/chromeos/input_method/component_extension_ime_manager_impl.h', - 'browser/chromeos/input_method/input_method_whitelist.cc', - 'browser/chromeos/input_method/input_method_whitelist.h', 'browser/chromeos/input_method/mock_ibus_controller.cc', 'browser/chromeos/input_method/mock_ibus_controller.h', 'browser/chromeos/input_method/xkeyboard.cc', diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 790f404..320f863 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -741,8 +741,8 @@ ['chromeos==1', { 'dependencies': [ '../build/linux/system.gyp:dbus', + '../chromeos/ime/input_method.gyp:gencode', '../third_party/libevent/libevent.gyp:libevent', - 'browser/chromeos/input_method/input_method.gyp:gencode', 'contacts_proto', ], 'sources!': [ diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index d46e43c..7c4a151 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -602,7 +602,6 @@ 'browser/chromeos/input_method/input_method_manager_impl_unittest.cc', 'browser/chromeos/input_method/input_method_persistence_unittest.cc', 'browser/chromeos/input_method/input_method_util_unittest.cc', - 'browser/chromeos/input_method/input_method_whitelist_unittest.cc', 'browser/chromeos/input_method/xkeyboard_unittest.cc', 'browser/chromeos/kiosk_mode/kiosk_mode_idle_logout_unittest.cc', 'browser/chromeos/kiosk_mode/kiosk_mode_settings_unittest.cc', diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp index f75c84a..fc145e9 100644 --- a/chromeos/chromeos.gyp +++ b/chromeos/chromeos.gyp @@ -22,6 +22,7 @@ '../dbus/dbus.gyp:dbus', '../net/net.gyp:net', '../third_party/libxml/libxml.gyp:libxml', + 'ime/input_method.gyp:gencode', 'power_manager_proto', 'power_supply_properties_proto', 'video_activity_update_proto', @@ -171,6 +172,8 @@ 'ime/input_method_descriptor.h', 'ime/input_method_property.cc', 'ime/input_method_property.h', + 'ime/input_method_whitelist.cc', + 'ime/input_method_whitelist.h', 'network/cros_network_functions.cc', 'network/cros_network_functions.h', 'network/device_state.cc', @@ -416,6 +419,7 @@ 'ime/extension_ime_util_unittest.cc', 'ime/input_method_descriptor_unittest.cc', 'ime/input_method_property_unittest.cc', + 'ime/input_method_whitelist_unittest.cc', 'network/cros_network_functions_unittest.cc', 'network/geolocation_handler_unittest.cc', 'network/network_change_notifier_chromeos_unittest.cc', diff --git a/chrome/browser/chromeos/input_method/gen_input_methods.py b/chromeos/ime/gen_input_methods.py index a9f90bf..a9f90bf 100755 --- a/chrome/browser/chromeos/input_method/gen_input_methods.py +++ b/chromeos/ime/gen_input_methods.py diff --git a/chrome/browser/chromeos/input_method/input_method.gyp b/chromeos/ime/input_method.gyp index a88ded1..1da130e 100644 --- a/chrome/browser/chromeos/input_method/input_method.gyp +++ b/chromeos/ime/input_method.gyp @@ -5,7 +5,7 @@ { 'variables': { 'input_method_out_dir': - '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/chromeos/input_method', + '<(SHARED_INTERMEDIATE_DIR)/chromeos/ime', }, 'targets': [ { diff --git a/chrome/browser/chromeos/input_method/input_method_whitelist.cc b/chromeos/ime/input_method_whitelist.cc index bba13d5..ba0b7b8 100644 --- a/chrome/browser/chromeos/input_method/input_method_whitelist.cc +++ b/chromeos/ime/input_method_whitelist.cc @@ -1,13 +1,13 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/input_method/input_method_whitelist.h" +#include "chromeos/ime/input_method_whitelist.h" #include <vector> -#include "chrome/browser/chromeos/input_method/input_methods.h" #include "chromeos/ime/input_method_descriptor.h" +#include "chromeos/ime/input_methods.h" namespace chromeos { namespace input_method { diff --git a/chrome/browser/chromeos/input_method/input_method_whitelist.h b/chromeos/ime/input_method_whitelist.h index f6accdc..3a22493 100644 --- a/chrome/browser/chromeos/input_method/input_method_whitelist.h +++ b/chromeos/ime/input_method_whitelist.h @@ -1,9 +1,9 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_WHITELIST_H_ -#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_WHITELIST_H_ +#ifndef CHROMEOS_IME_INPUT_METHOD_WHITELIST_H_ +#define CHROMEOS_IME_INPUT_METHOD_WHITELIST_H_ #include <set> #include <string> @@ -11,6 +11,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" +#include "chromeos/chromeos_export.h" namespace chromeos { namespace input_method { @@ -18,8 +19,9 @@ namespace input_method { class InputMethodDescriptor; typedef std::vector<InputMethodDescriptor> InputMethodDescriptors; -// -class InputMethodWhitelist { +// A class which has white listed input method list. The list is generated by +// gen_input_methods.py from input_methods.txt. +class CHROMEOS_EXPORT InputMethodWhitelist { public: InputMethodWhitelist(); ~InputMethodWhitelist(); @@ -41,4 +43,4 @@ class InputMethodWhitelist { } // namespace input_method } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_WHITELIST_H_ +#endif // CHROMEOS_IME_INPUT_METHOD_WHITELIST_H_ diff --git a/chrome/browser/chromeos/input_method/input_method_whitelist_unittest.cc b/chromeos/ime/input_method_whitelist_unittest.cc index 8718d8a..eb4ed28 100644 --- a/chrome/browser/chromeos/input_method/input_method_whitelist_unittest.cc +++ b/chromeos/ime/input_method_whitelist_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/logging.h" -#include "chrome/browser/chromeos/input_method/input_method_whitelist.h" +#include "chromeos/ime/input_method_whitelist.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos { diff --git a/chromeos/ime/input_methods.txt b/chromeos/ime/input_methods.txt new file mode 100644 index 0000000..1d1d9ab --- /dev/null +++ b/chromeos/ime/input_methods.txt @@ -0,0 +1,212 @@ +# The list of input methods that we support. The input methods metadata is +# also defined here. We use this data for the following purposes. +# +# 1. Exclude unnecessary input methods. For example, we don't need +# "ja:anthy", and "zh:pinyin" engines in ibus-m17n since we have better +# alternatives outside of ibus-m17n. Excluding these input methods from +# the IBus engine XML files, such as /usr/share/ibus/component/m17n.xml, +# makes the startup time of the IBus daemon faster. This filtering is +# done using a python script at build time of ibus-m17n. +# See crosbug.com/4161 for details. +# +# 2. Provide the input methods metadata to Chrome at build time. Chrome +# needs to know about the supported input methods for the input method +# features, such as the input method switching and the options page, +# to work. Note that we can retrieve the same metadata from the IBus +# daemon, but Chrome needs be able to get the metadata without talking +# to the IBus daemon. This requirement comes from the fact that the +# IBus daemon should not run if the user is just using keyboard layouts +# such as US keyboard. The metadata generation is done using a python +# script at build time of Chrome. See crosbug.com/16961 for details. +# +# The order of the list is important. In Chrome's "Languages and input" options +# page, we list input methods in this order, when more than one input methods +# are available for a language (ex. French). +# +# Each non-comment line contains the following tab-separated columns. +# +# 1) The input method ID used by Chrome. (ex. "xkb:ca::fra") You should *NEVER* +# change the ID since the ID might be written in user's ~/Preferences. For +# example, three-letter ISO 639-2/B codes are used for IDs start with "xkb:" +# for histrical reason, but we should not replace them with two-letter 639-1 +# codes that are currently in use in the 3rd column. +# 2) The keyboard layout ID used by XKB. (ex. "us", "us(dvorak)", "ca", +# "handwriting-vk,jp"). See also: /usr/share/X11/xkb/symbols. +# 3) The language code (ex. "fr"). Only one format, ISO 639-1 compliant two- +# letter language code which can be recognized by ICU, is allowed. Do not use +# three-letter ones (ISO 639-2/T and 639-2/B) here. For "en", "pt", and "zh", +# two-letter upper-case country code should be added (ex. "en-US", "zh-TW"). +# See http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes for details. +# 4) [optional] The #if condition for the input method. +# (ex. "defined(A)", "!defined(A)||defined(B)") +# +# Notes: +# When adding a line to this list, please also add a mapping from the input +# method ID to the keyboard overlay ID to INPUT_METHOD_ID_TO_OVERLAY_ID in +# +# * tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py +# +# and update the following files by running this script. +# +# * chrome/app/generated_resources.grd +# * chrome/browser/resources/chromeos/keyboard_overlay_data.js +# * chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc +# +# If you add an XKB layout which depends on X11's Mod3Mask (e.g. Germany Neo2 +# XKB layout), you should also update IsMod3UsedByCurrentInputMethod() method +# in chrome/browser/ui/ash/event_rewriter.cc. Otherwise, Mod3Mask might be +# removed unexpectedly by the rewriter. + +# U.S. English +xkb:us::eng us en-US +xkb:us:intl:eng us(intl) en-US +xkb:us:altgr-intl:eng us(altgr-intl) en-US +xkb:us:dvorak:eng us(dvorak) en-US +xkb:us:colemak:eng us(colemak) en-US +english-m us en-US +# U.S. English entiries have to be above the Dutch entry so that xkb:us:intl:eng +# will be selected as the default keyboard when the UI language is set to Dutch. + +# Dutch +xkb:be::nld be nl +# We don't support xkb:nl::nld. See b/4430951. + +# French +xkb:fr::fra fr fr +xkb:be::fra be fr +xkb:ca::fra ca fr +xkb:ch:fr:fra ch(fr) fr + +# German +xkb:de::ger de de +xkb:de:neo:ger de(neo) de +xkb:be::ger be de +xkb:ch::ger ch de + +# Japanese +mozc us ja +mozc-jp jp ja +mozc-dv us(dvorak) ja +# |kMozcJaInputMethodIds| in ibus_ui_controller.cc should also be updated when +# a new Mozc Japanese IME for another keyboard layout is added. +xkb:jp::jpn jp ja + +# Russian +xkb:ru::rus ru ru +xkb:ru:phonetic:rus ru(phonetic) ru + +# Thai +m17n:th:kesmanee us th +m17n:th:pattachote us th +m17n:th:tis820 us th + +# Simplified Chinese +pinyin us zh-CN +pinyin-dv us(dvorak) zh-CN + +# Traditional Chinese +mozc-chewing us zh-TW +m17n:zh:cangjie us zh-TW +m17n:zh:quick us zh-TW + +# Vietnamese +m17n:vi:tcvn us vi +m17n:vi:telex us vi +m17n:vi:viqr us vi +m17n:vi:vni us vi +# Note: Since Chrome does not support "get surrounding text" feature yet, +# Vietnames input methods, except 4 input methods above, in m17n-db should +# not work fine. The 4 input methods in m17n-db (>= 1.6.0) don't require the +# feature. + +# Korean +mozc-hangul kr(kr104) ko +xkb:kr:kr104:kor kr(kr104) ko + +# Arabic +m17n:ar:kbd us ar +# TODO(yusukes,jshin): Check if we can use ibux-xkb-layouts for Arabic, Hindi, +# etc. + +# Hindi +m17n:hi:itrans us hi +# Note: the m17n-contrib package has some more Hindi IMEs. + +# Farsi (Persian) +m17n:fa:isiri us fa + +# Bengali +m17n:bn:itrans us bn +# TODO(yusukes): Support the following IMEs in m17n-db (unijoy) and +# m17n-db-contrib (inscript, probhat). +# m17n:bn:unijoy us bn +# m17n:bn:inscript us bn +# m17n:bn:probhat us bn + +# Gujarati +m17n:gu:itrans us gu +# TODO(yusukes): Support the following IMEs in m17n-db-contrib. +# m17n:gu:phonetic us gu +# m17n:gu:inscript us gu + +# Malayalam +m17n:ml:itrans us ml +# TODO(yusukes): Support the following IMEs in m17n-db-contrib. +# m17n:ml:inscript us ml +# m17n:ml:mozhi us ml + +# Marathi +# Note: m17n:mr:itrans is in m17n-db-contrib. +m17n:mr:itrans us mr +# TODO(yusukes): Support the following IMEs in m17n-db-contrib. +# m17n:mr:phonetic us mr +# m17n:mr:inscript us mr + +# Tamil +m17n:ta:phonetic us ta +m17n:ta:inscript us ta +m17n:ta:tamil99 us ta +m17n:ta:itrans us ta +m17n:ta:typewriter us ta + +# Telugu +m17n:te:itrans us te +# Kannada +m17n:kn:itrans us kn + +# Amharic +m17n:am:sera us am + +# Keyboard layouts. +xkb:br::por br pt-BR +xkb:bg::bul bg bg +xkb:bg:phonetic:bul bg(phonetic) bg +xkb:ca:eng:eng ca(eng) en-CA +xkb:cz::cze cz cs +xkb:ee::est ee et +xkb:es::spa es es +xkb:es:cat:cat es(cat) ca +xkb:dk::dan dk da +xkb:gr::gre gr el +xkb:il::heb il he +xkb:latam::spa latam es +xkb:lt::lit lt lt +xkb:lv:apostrophe:lav lv(apostrophe) lv +xkb:hr::scr hr hr +xkb:gb:extd:eng gb(extd) en-GB +xkb:gb:dvorak:eng gb(dvorak) en-GB +xkb:fi::fin fi fi +xkb:hu::hun hu hu +xkb:it::ita it it +xkb:no::nob no nb +xkb:pl::pol pl pl +xkb:pt::por pt pt-PT +xkb:ro::rum ro ro +xkb:se::swe se sv +xkb:sk::slo sk sk +xkb:si::slv si sl +xkb:rs::srp rs sr +xkb:tr::tur tr tr +xkb:ua::ukr ua uk +# TODO(yusukes): Support xkb:latam:deadtilde:spa and/or xkb:latam:nodeadkeys:spa +# if necessary. |