| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 [ |
| 6 { |
| 7 "namespace": "input.ime", |
| 8 "platforms": ["chromeos"], |
| 9 "types": [ |
| 10 { |
| 11 "id": "KeyboardEvent", |
| 12 "type": "object", |
| 13 "description": "See http://www.w3.org/TR/DOM-Level-3-Events/#events-Keyb
oardEvent", |
| 14 "properties": { |
| 15 "type": {"type": "string", "description": "One of keyup or keydown.",
"enum": ["keyup", "keydown"]}, |
| 16 "requestId": {"type": "string", "description": "The ID of the request.
"}, |
| 17 "key": {"type": "string", "description": "Value of the key being press
ed"}, |
| 18 "altKey": {"type": "boolean", "optional": true, "description": "Whethe
r or not the ALT key is pressed."}, |
| 19 "ctrlKey": {"type": "boolean", "optional": true, "description": "Wheth
er or not the CTRL key is pressed."}, |
| 20 "shiftKey": {"type": "boolean", "optional": true, "description": "Whet
her or not the SHIFT key is pressed."} |
| 21 } |
| 22 }, |
| 23 { |
| 24 "id": "InputContext", |
| 25 "type": "object", |
| 26 "description": "Describes an input Context", |
| 27 "properties": { |
| 28 "contextID": {"type": "integer", "description": "This is used to speci
fy targets of text field operations. This ID becomes invalid as soon as onBlur
is called."}, |
| 29 "type": {"type": "string", "description": "Type of value this text fie
ld edits, (Text, Number, Password, etc)", "enum": ["text", "number", "password"]
} |
| 30 } |
| 31 } |
| 32 ], |
| 33 "functions": [ |
| 34 { |
| 35 "name": "setComposition", |
| 36 "type": "function", |
| 37 "description": "Set the current composition. If this extension does not
own the active IME, this fails.", |
| 38 "parameters": [ |
| 39 { |
| 40 "name": "parameters", |
| 41 "type": "object", |
| 42 "properties": { |
| 43 "contextID": { |
| 44 "description": "ID of the context where the composition text wil
l be set", |
| 45 "type": "integer" |
| 46 }, |
| 47 "text": { |
| 48 "description": "Text to set", |
| 49 "type": "string" |
| 50 }, |
| 51 "selectionStart": { |
| 52 "description": "Position in the text that the selection starts a
t.", |
| 53 "optional": true, |
| 54 "type": "integer" |
| 55 }, |
| 56 "selectionEnd": { |
| 57 "description": "Position in the text that the selection ends at.
", |
| 58 "optional": true, |
| 59 "type": "integer" |
| 60 }, |
| 61 "cursor": { |
| 62 "description": "Position in the text of the cursor.", |
| 63 "type": "integer" |
| 64 }, |
| 65 "segments": { |
| 66 "description": "List of segments and their associated types.", |
| 67 "type": "array", |
| 68 "optional": true, |
| 69 "items": { |
| 70 "type": "object", |
| 71 "properties": { |
| 72 "start": { |
| 73 "description": "Index of the character to start this segme
nt at", |
| 74 "type": "integer" |
| 75 }, |
| 76 "end": { |
| 77 "description": "Index of the character to end this segment
after.", |
| 78 "type": "integer" |
| 79 }, |
| 80 "style": { |
| 81 "description": "How to render this segment", |
| 82 "enum": ["underline", "doubleUnderline"], |
| 83 "type": "string" |
| 84 } |
| 85 } |
| 86 } |
| 87 } |
| 88 } |
| 89 }, |
| 90 { |
| 91 "type": "function", |
| 92 "name": "callback", |
| 93 "optional": true, |
| 94 "description": "Called when the operation completes with a boolean i
ndicating if the text was accepted or not. On failure, chrome.runtime.lastError
is set.", |
| 95 "parameters": [ |
| 96 { |
| 97 "name": "success", |
| 98 "type": "boolean" |
| 99 } |
| 100 ] |
| 101 } |
| 102 ] |
| 103 }, |
| 104 { |
| 105 "name": "clearComposition", |
| 106 "type": "function", |
| 107 "description": "Clear the current composition. If this extension does no
t own the active IME, this fails.", |
| 108 "parameters": [ |
| 109 { |
| 110 "name": "parameters", |
| 111 "type": "object", |
| 112 "properties": { |
| 113 "contextID": { |
| 114 "description": "ID of the context where the composition will be
cleared", |
| 115 "type": "integer" |
| 116 } |
| 117 } |
| 118 }, |
| 119 { |
| 120 "type": "function", |
| 121 "name": "callback", |
| 122 "optional": true, |
| 123 "description": "Called when the operation completes with a boolean i
ndicating if the text was accepted or not. On failure, chrome.runtime.lastError
is set.", |
| 124 "parameters": [ |
| 125 { |
| 126 "name": "success", |
| 127 "type": "boolean" |
| 128 } |
| 129 ] |
| 130 } |
| 131 ] |
| 132 }, |
| 133 { |
| 134 "name": "commitText", |
| 135 "type": "function", |
| 136 "description": "Commits the provided text to the current input.", |
| 137 "parameters": [ |
| 138 { |
| 139 "name": "parameters", |
| 140 "type": "object", |
| 141 "properties": { |
| 142 "contextID": { |
| 143 "description": "ID of the context where the text will be committ
ed", |
| 144 "type": "integer" |
| 145 }, |
| 146 "text": { |
| 147 "description": "The text to commit", |
| 148 "type": "string" |
| 149 } |
| 150 } |
| 151 }, |
| 152 { |
| 153 "type": "function", |
| 154 "name": "callback", |
| 155 "optional": true, |
| 156 "description": "Called when the operation completes with a boolean i
ndicating if the text was accepted or not. On failure, chrome.runtime.lastError
is set.", |
| 157 "parameters": [ |
| 158 { |
| 159 "name": "success", |
| 160 "type": "boolean" |
| 161 } |
| 162 ] |
| 163 } |
| 164 ] |
| 165 }, |
| 166 { |
| 167 "name": "setCandidateWindowProperties", |
| 168 "type": "function", |
| 169 "description": "Sets the properties of the candidate window. This fails
if the extension doesn’t own the active IME", |
| 170 "parameters": [ |
| 171 { |
| 172 "name": "parameters", |
| 173 "type": "object", |
| 174 "properties": { |
| 175 "engineID": { |
| 176 "description": "ID of the engine to set properties on.", |
| 177 "type": "string" |
| 178 }, |
| 179 "properties": { |
| 180 "type": "object", |
| 181 "properties": { |
| 182 "visible": { |
| 183 "type": "boolean", |
| 184 "optional": true, |
| 185 "description": "True to show the Candidate window, false to
hide it." |
| 186 }, |
| 187 "cursorVisible": { |
| 188 "type": "boolean", |
| 189 "optional": true, |
| 190 "description": "True to show the cursor, false to hide it." |
| 191 }, |
| 192 "vertical": { |
| 193 "type": "boolean", |
| 194 "optional": true, |
| 195 "description": "True if the candidate window should be rende
red vertical, false to make it horizontal." |
| 196 }, |
| 197 "pageSize": { |
| 198 "type": "integer", |
| 199 "optional": true, |
| 200 "description": "The number of candidates to display per page
." |
| 201 }, |
| 202 "auxiliaryText": { |
| 203 "type": "string", |
| 204 "optional": true, |
| 205 "description": "Text that is shown at the bottom of the cand
idate window." |
| 206 }, |
| 207 "auxiliaryTextVisible": { |
| 208 "type": "boolean", |
| 209 "optional": true, |
| 210 "description": "True to display the auxiliary text, false to
hide it." |
| 211 } |
| 212 } |
| 213 } |
| 214 } |
| 215 }, |
| 216 { |
| 217 "type": "function", |
| 218 "name": "callback", |
| 219 "optional": true, |
| 220 "description": "Called when the operation completes.", |
| 221 "parameters": [ |
| 222 { |
| 223 "name": "success", |
| 224 "type": "boolean" |
| 225 } |
| 226 ] |
| 227 } |
| 228 ] |
| 229 }, |
| 230 { |
| 231 "name": "setCandidates", |
| 232 "type": "function", |
| 233 "description": "Sets the current candidate list. This fails if this exte
nsion doesn’t own the active IME", |
| 234 "parameters": [ |
| 235 { |
| 236 "name": "parameters", |
| 237 "type": "object", |
| 238 "properties": { |
| 239 "contextID": { |
| 240 "description": "ID of the context that owns the candidate window
.", |
| 241 "type": "integer" |
| 242 }, |
| 243 "candidates": { |
| 244 "description": "List of candidates to show in the candidate wind
ow", |
| 245 "type": "array", |
| 246 "items": { |
| 247 "type": "object", |
| 248 "properties": { |
| 249 "candidate": {"type": "string", "description": "The candidat
e"}, |
| 250 "id": {"type": "integer", "description": "The candidate's id
"}, |
| 251 "parentId": {"type": "integer", "optional": true, "descripti
on": "The id to add these candidates under"}, |
| 252 "label": {"type": "string", "optional": true, "description":
"Short string displayed to next to the candidate, often the shortcut key or ind
ex"}, |
| 253 "annotation": {"type": "string", "optional": true, "descript
ion": "Additional text describing the candidate"}, |
| 254 "usage": { |
| 255 "type": "object", |
| 256 "optional": true, |
| 257 "description": "The usage or detail description of word.", |
| 258 "properties": { |
| 259 "title": { "type": "string", "description": "The title s
tring of details description."}, |
| 260 "body": { "type": "string", "description": "The body str
ing of detail description."} |
| 261 } |
| 262 } |
| 263 } |
| 264 } |
| 265 } |
| 266 } |
| 267 }, |
| 268 { |
| 269 "type": "function", |
| 270 "name": "callback", |
| 271 "optional": true, |
| 272 "description": "Called when the operation completes.", |
| 273 "parameters": [ |
| 274 { |
| 275 "name": "success", |
| 276 "type": "boolean" |
| 277 } |
| 278 ] |
| 279 } |
| 280 ] |
| 281 }, |
| 282 { |
| 283 "name": "setCursorPosition", |
| 284 "type": "function", |
| 285 "description": "Set the position of the cursor in the candidate window.
This is a no-op if this extension does not own the active IME.", |
| 286 "parameters": [ |
| 287 { |
| 288 "name": "parameters", |
| 289 "type": "object", |
| 290 "properties": { |
| 291 "contextID": { |
| 292 "description": "ID of the context that owns the candidate window
.", |
| 293 "type": "integer" |
| 294 }, |
| 295 "candidateID": { |
| 296 "description": "ID of the candidate to select.", |
| 297 "type": "integer" |
| 298 } |
| 299 } |
| 300 }, |
| 301 { |
| 302 "type": "function", |
| 303 "name": "callback", |
| 304 "optional": true, |
| 305 "description": "Called when the operation completes", |
| 306 "parameters": [ |
| 307 { |
| 308 "name": "success", |
| 309 "type": "boolean" |
| 310 } |
| 311 ] |
| 312 } |
| 313 ] |
| 314 }, |
| 315 { |
| 316 "name": "setMenuItems", |
| 317 "type": "function", |
| 318 "description": "Adds the provided menu items to the language menu when t
his IME is active.", |
| 319 "parameters": [ |
| 320 { |
| 321 "name": "parameters", |
| 322 "type": "object", |
| 323 "properties": { |
| 324 "engineID": { |
| 325 "description": "ID of the engine to use", |
| 326 "type": "string" |
| 327 }, |
| 328 "items": { |
| 329 "description": "MenuItems to add. They will be added in the orde
r they exist in the array.", |
| 330 "type": "array", |
| 331 "items": { |
| 332 "type": "object", |
| 333 "description": "A menu item used by an input method to interac
t with the user from the language menu.", |
| 334 "properties": { |
| 335 "id": {"type": "string", "description": "String that will be
passed to callbacks referencing this MenuItem."}, |
| 336 "label": {"type": "string", "optional": true, "description":
"Text displayed in the menu for this item."}, |
| 337 "style": { |
| 338 "type": "string", |
| 339 "optional": true, |
| 340 "description": "Enum representing if this item is: none, c
heck, radio, or a separator. Radio buttons between separators are considered gr
ouped.", |
| 341 "enum": ["none", "check", "radio", "separator"] |
| 342 }, |
| 343 "visible": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item is visible."}, |
| 344 "checked": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item should be drawn with a check."}, |
| 345 "enabled": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item is enabled."} |
| 346 } |
| 347 } |
| 348 } |
| 349 } |
| 350 }, |
| 351 { |
| 352 "type": "function", |
| 353 "name": "callback", |
| 354 "optional": true, |
| 355 "description": "", |
| 356 "parameters": [] |
| 357 } |
| 358 ] |
| 359 }, |
| 360 { |
| 361 "name": "updateMenuItems", |
| 362 "type": "function", |
| 363 "description": "Updates the state of the MenuItems specified", |
| 364 "parameters": [ |
| 365 { |
| 366 "name": "parameters", |
| 367 "type": "object", |
| 368 "properties": { |
| 369 "engineID": { |
| 370 "description": "ID of the engine to use", |
| 371 "type": "string" |
| 372 }, |
| 373 "items": { |
| 374 "description": "Array of MenuItems to update", |
| 375 "type": "array", |
| 376 "items": { |
| 377 "type": "object", |
| 378 "description": "A menu item used by an input method to interac
t with the user from the language menu.", |
| 379 "properties": { |
| 380 "id": {"type": "string", "description": "String that will be
passed to callbacks referencing this MenuItem."}, |
| 381 "label": {"type": "string", "optional": true, "description":
"Text displayed in the menu for this item."}, |
| 382 "style": { |
| 383 "type": "string", |
| 384 "optional": true, |
| 385 "description": "Enum representing if this item is: none, c
heck, radio, or a separator. Radio buttons between separators are considered gr
ouped.", |
| 386 "enum": ["none", "check", "radio", "separator"] |
| 387 }, |
| 388 "visible": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item is visible."}, |
| 389 "checked": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item should be drawn with a check."}, |
| 390 "enabled": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item is enabled."} |
| 391 } |
| 392 } |
| 393 } |
| 394 } |
| 395 }, |
| 396 { |
| 397 "type": "function", |
| 398 "name": "callback", |
| 399 "optional": true, |
| 400 "description": "Called when the operation completes", |
| 401 "parameters": [] |
| 402 } |
| 403 ] |
| 404 }, |
| 405 { |
| 406 "name": "keyEventHandled", |
| 407 "type": "function", |
| 408 "description": "Indicates that the key event received by onKeyEvent is h
andled. This should only be called if the onKeyEvent listener is asynchronous."
, |
| 409 "parameters": [ |
| 410 {"type": "string", "name": "requestId", "description": "Request id of
the event that was handled. This should come from keyEvent.requestId"}, |
| 411 {"type": "boolean", "name": "response", "description": "True if the ke
ystroke was handled, false if not"} |
| 412 ] |
| 413 } |
| 414 ], |
| 415 "events": [ |
| 416 { |
| 417 "name": "onActivate", |
| 418 "type": "function", |
| 419 "description": "This event is sent when an IME is activated. It signals
that the IME will be receiving onKeyPress events.", |
| 420 "parameters": [ |
| 421 { |
| 422 "type": "string", |
| 423 "name": "engineID", |
| 424 "description": "ID of the engine receiving the event" |
| 425 } |
| 426 ] |
| 427 }, |
| 428 { |
| 429 "name": "onDeactivated", |
| 430 "type": "function", |
| 431 "description": "This event is sent when an IME is deactivated. It signal
s that the IME will no longer be receiving onKeyPress events.", |
| 432 "parameters": [ |
| 433 { |
| 434 "type": "string", |
| 435 "name": "engineID", |
| 436 "description": "ID of the engine receiving the event" |
| 437 } |
| 438 ] |
| 439 }, |
| 440 { |
| 441 "name": "onFocus", |
| 442 "type": "function", |
| 443 "description": "This event is sent when focus enters a text box. It is s
ent to all extensions that are listening to this event, and enabled by the user.
", |
| 444 "parameters": [ |
| 445 { |
| 446 "$ref": "InputContext", |
| 447 "name": "context", |
| 448 "description": "Describes the text field that has acquired focus." |
| 449 } |
| 450 ] |
| 451 }, |
| 452 { |
| 453 "name": "onBlur", |
| 454 "type": "function", |
| 455 "description": "This event is sent when focus leaves a text box. It is s
ent to all extensions that are listening to this event, and enabled by the user.
", |
| 456 "parameters": [ |
| 457 { |
| 458 "type": "integer", |
| 459 "name": "contextID", |
| 460 "description": "The ID of the text field that has lost focus. The ID
is invalid after this call" |
| 461 } |
| 462 ] |
| 463 }, |
| 464 { |
| 465 "name": "onInputContextUpdate", |
| 466 "type": "function", |
| 467 "description": "This event is sent when the properties of the current In
putContext change, such as the the type. It is sent to all extensions that are l
istening to this event, and enabled by the user.", |
| 468 "parameters": [ |
| 469 { |
| 470 "$ref": "InputContext", |
| 471 "name": "context", |
| 472 "description": "An InputContext object describing the text field tha
t has changed." |
| 473 } |
| 474 ] |
| 475 }, |
| 476 { |
| 477 "name": "onKeyEvent", |
| 478 "type": "function", |
| 479 "description": "This event is sent if this extension owns the active IME
.", |
| 480 "options": { |
| 481 "supportsFilters": false, |
| 482 "supportsListeners": true, |
| 483 "supportsRules": false, |
| 484 "maxListeners": 1 |
| 485 }, |
| 486 "parameters": [ |
| 487 { |
| 488 "type": "string", |
| 489 "name": "engineID", |
| 490 "description": "ID of the engine receiving the event" |
| 491 }, |
| 492 { |
| 493 "$ref": "KeyboardEvent", |
| 494 "name": "keyData", |
| 495 "description": "Data on the key event" |
| 496 } |
| 497 ], |
| 498 "extraParameters": [ |
| 499 { |
| 500 "type": "array", |
| 501 "optional": true, |
| 502 "name": "extraInfoSpec", |
| 503 "description": "Array of extra information that specifies how the ca
llback is invoked.", |
| 504 "items": { |
| 505 "type": "string", |
| 506 "enum": ["async"] |
| 507 } |
| 508 } |
| 509 ], |
| 510 "returns": { |
| 511 "type": "boolean", |
| 512 "description": "True if the keystroke was handled, false if not. This
function should always return a value if |async| is not specified.", |
| 513 "optional": true |
| 514 } |
| 515 }, |
| 516 { |
| 517 "name": "onCandidateClicked", |
| 518 "type": "function", |
| 519 "description": "This event is sent if this extension owns the active IME
.", |
| 520 "parameters": [ |
| 521 { |
| 522 "type": "string", |
| 523 "name": "engineID", |
| 524 "description": "ID of the engine receiving the event" |
| 525 }, |
| 526 { |
| 527 "type": "integer", |
| 528 "name": "candidateID", |
| 529 "description": "ID of the candidate that was clicked." |
| 530 }, |
| 531 { |
| 532 "type": "string", |
| 533 "name": "button", |
| 534 "description": "Which mouse buttons was clicked.", |
| 535 "enum": ["left", "middle", "right"] |
| 536 } |
| 537 ] |
| 538 }, |
| 539 { |
| 540 "name": "onMenuItemActivated", |
| 541 "type": "function", |
| 542 "description": "Called when the user selects a menu item", |
| 543 "parameters": [ |
| 544 { |
| 545 "type": "string", |
| 546 "name": "engineID", |
| 547 "description": "ID of the engine receiving the event" |
| 548 }, |
| 549 { |
| 550 "type": "string", |
| 551 "name": "name", |
| 552 "description": "Name of the MenuItem which was activated" |
| 553 } |
| 554 ] |
| 555 } |
| 556 ] |
| 557 } |
| 558 ] |
| OLD | NEW |