the Chromium logo

The Chromium Projects

Input Method Editor

Overview The purpose of this API is to allow third parties to develop IMEs for Chrome OS via extensions. Use cases This API would be used to create IMEs that aren’t included in Chrome OS. This could include Cloud IME solutions, alternate CJK IMEs, or English IMEs and writing assistants. There are three basic types of input we should support:

An input method extension can behave as any or all of these, but only a single extension can be active as an IME at a time. Could this API be part of the web platform? This is a client side feature, and doesn’t make much sense to add to HTML5 Do you expect this API to be fairly stable? Once finalized, I don’t expect this API to change in any way that would break backwards compatibility.

What UI does this API expose? On ChromeOS, the user interacts with this API through the IME selection button, and the candidate window. As such, no new UI would need to be added. To implement this API on Windows, Mac and Linux, an IME selection method would need to be added, and the candidate window would need to be exposed. Candidate Windowimage Language Selectionimage How could this API be abused? The biggest danger of this API is that it could easily be used to create key loggers. Android deals with this issue by adding additional security dialogs to enable third party IMEs. The danger is mitigated slightly by the fact that password dialogs do not send their keystrokes to IME. Extensions that generate keystrokes such as virtual keyboards will still be able to send keystrokes to password fields and could record this data, however. This should be protected by both the standard security warning during installation, and an additional warning/confirmation dialog when enabled for the first time. How would you implement your desired features if this API didn’t exist? There is currently no way for third parties to add IMEs to Chrome OS. Allowing IMEs executing in any other context than sandboxed Javascript seems much more dangerous from a security standpoint. Are you willing and able to develop and maintain this API? Yes.

Draft API spec To prevent abuse of IMEs, the API will be guarded by the “ime” permission in manifest.json.

Manifest Entries:

To use the ime.engine APIs, you need to specify an input_components entry in the manifest. It will contain an array describing any input components in the extension.

It should look like:

"input_components" = [

{

"name": "My IME", // A user visible name.

"type": "ime", // The type of input component.

"id": "my_ime", // The id that will be passed to callbacks

"description": "My Input method for Japanese", // A user visible description

"language": "ja", // The primary language this IME is used for

"layouts": {"jp::jpn", "us:dvorak:eng"} // The supported keyboard layouts for this IME

}

]

Types:

Methods: chrome.

input.ime

.setComposition**

chrome.

input

.ime

.clearComposition**

chrome.

input

.ime

.commitText**

chrome.

input

.ime

.setCandidateWindowProperties**

chrome.

input

.ime

.setCandidates**

chrome.

input

.ime

.setCursorPosition**

chrome.

input

.ime

.setMenuItems**

chrome.

input

.ime

.updateMenuItems**

chrome.

input

.ime

.sendKeyEvent**

Events chrome.

input

.ime

.onActivate**

chrome.

input

.ime

.onDeactivated**

chrome.

input

.ime

.onFocus**

chrome.

input

.ime

.onBlur**

chrome.

input

.ime

.onInputContextUpdate**

chrome.

input

.ime

.onKeyEvent**

chrome.

input

.ime

.onCandidateClicked**

chrome.

input

.ime.onMenuItemActivated

Open questions