Expose Japanese IME settings in InputMethodSettings private API.
This private API is primarily meant for exclusive use by
CrOS 1P Virtual Keyboard (VK). API impl [1] seems to include
any entries available in CrOS Prefs storage (incl. these
Japanese IME related entries), but only those exposed via
typings declaration can be properly accessed by clients in
a type-safe manner.
After the migration to CrOS Settings app & CrOS Prefs storage,
Japanese IME settings in CrOS Prefs (accessed via this private
API) are nowadays the canonical source-of-truth that should be
accessible and used by CrOS 1P VK, instead of Mozc-managed ones.
input_method_private.d.ts is autogen using the following command:
$ tools/json_schema_compiler/compiler.py \
chrome/common/extensions/api/input_method_private.json \
-g ts_definitions \
> chrome/browser/resources/chromeos/accessibility/definitions/input_method_private.d.ts
input_method_private.js is autogen using the following command:
$ tools/json_schema_compiler/compiler.py \
chrome/common/extensions/api/input_method_private.json \
-g externs \
> third_party/closure_compiler/externs/input_method_private.js
[1] https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ash/extensions/input_method_api.cc;l=362-400;drc=7f7a5a42a57cbff5a0b966f59fdf426c01218602
Bug: b:443220047
Change-Id: I8d1b31a7ccd7163d18225f704cc93710048d1b5e
Cq-Include-Trybots: luci.chrome.try:linux-chromeos-chrome;luci.chromium.try:linux-chromeos-rel,linux-chromeos-dbg;luci.chrome.try:chromeos-betty-chrome,chromeos-betty-chrome-dchecks
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7197221
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Darren Shen <shend@chromium.org>
Commit-Queue: Bao-Duy Tran <tranbaoduy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1550494}
NOKEYCHECK=True
GitOrigin-RevId: 42b18359b37c4d6ca87656ab3e933d74e37f676c
diff --git a/input_method_private.js b/input_method_private.js
index 00a9912..68d8db5 100644
--- a/input_method_private.js
+++ b/input_method_private.js
@@ -136,8 +136,74 @@
chrome.inputMethodPrivate.InputContext;
/**
- * User preference settings for a specific input method. Japanese input methods
- * are not included because they are managed separately by Mozc module.
+ * @enum {string}
+ */
+chrome.inputMethodPrivate.JapaneseInputMode = {
+ KANA: 'Kana',
+ ROMAJI: 'Romaji',
+};
+
+/**
+ * @enum {string}
+ */
+chrome.inputMethodPrivate.JapanesePunctuationStyle = {
+ KUTEN_TOUTEN: 'KutenTouten',
+ COMMA_PERIOD: 'CommaPeriod',
+ KUTEN_PERIOD: 'KutenPeriod',
+ COMMA_TOUTEN: 'CommaTouten',
+};
+
+/**
+ * @enum {string}
+ */
+chrome.inputMethodPrivate.JapaneseSymbolStyle = {
+ CORNER_BRACKET_MIDDLE_DOT: 'CornerBracketMiddleDot',
+ SQUARE_BRACKET_SLASH: 'SquareBracketSlash',
+ CORNER_BRACKET_SLASH: 'CornerBracketSlash',
+ SQUARE_BRACKET_MIDDLE_DOT: 'SquareBracketMiddleDot',
+};
+
+/**
+ * @enum {string}
+ */
+chrome.inputMethodPrivate.JapaneseSpaceInputStyle = {
+ INPUT_MODE: 'InputMode',
+ FULLWIDTH: 'Fullwidth',
+ HALFWIDTH: 'Halfwidth',
+};
+
+/**
+ * @enum {string}
+ */
+chrome.inputMethodPrivate.JapaneseSelectionShortcut = {
+ NO_SHORTCUT: 'NoShortcut',
+ DIGITS123456789: 'Digits123456789',
+ ASDFGHJKL: 'ASDFGHJKL',
+};
+
+/**
+ * @enum {string}
+ */
+chrome.inputMethodPrivate.JapaneseKeymapStyle = {
+ ATOK: 'Atok',
+ MS_IME: 'MsIme',
+ KOTOERI: 'Kotoeri',
+ CHROME_OS: 'ChromeOs',
+};
+
+/**
+ * @enum {string}
+ */
+chrome.inputMethodPrivate.ShiftKeyModeStyle = {
+ OFF: 'Off',
+ ALPHANUMERIC: 'Alphanumeric',
+ KATAKANA: 'Katakana',
+};
+
+/**
+ * User preference settings for a specific input method. Entry names MUST match
+ * CrOS Settings @
+ * https://crsrc.org/c/chrome/browser/resources/ash/settings/os_languages_page/input_method_util.ts
* @typedef {{
* enableCompletion: (boolean|undefined),
* enableDoubleSpacePeriod: (boolean|undefined),
@@ -152,6 +218,18 @@
* virtualKeyboardAutoCorrectionLevel: (number|undefined),
* virtualKeyboardEnableCapitalization: (boolean|undefined),
* xkbLayout: (string|undefined),
+ * JapaneseInputMode: (!chrome.inputMethodPrivate.JapaneseInputMode|undefined),
+ * JapanesePunctuationStyle: (!chrome.inputMethodPrivate.JapanesePunctuationStyle|undefined),
+ * JapaneseSymbolStyle: (!chrome.inputMethodPrivate.JapaneseSymbolStyle|undefined),
+ * JapaneseSpaceInputStyle: (!chrome.inputMethodPrivate.JapaneseSpaceInputStyle|undefined),
+ * JapaneseSectionShortcut: (!chrome.inputMethodPrivate.JapaneseSelectionShortcut|undefined),
+ * JapaneseKeymapStyle: (!chrome.inputMethodPrivate.JapaneseKeymapStyle|undefined),
+ * AutomaticallySwitchToHalfwidth: (boolean|undefined),
+ * ShiftKeyModeStyle: (!chrome.inputMethodPrivate.ShiftKeyModeStyle|undefined),
+ * UseInputHistory: (boolean|undefined),
+ * UseSystemDictionary: (boolean|undefined),
+ * numberOfSuggestions: (number|undefined),
+ * JapaneseDisableSuggestions: (boolean|undefined),
* koreanEnableSyllableInput: (boolean|undefined),
* koreanKeyboardLayout: (string|undefined),
* koreanShowHangulCandidate: (boolean|undefined),