// Copyright (c) 2012 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. [ { "namespace": "terminalPrivate", "compiler_options": { "implemented_in": "chrome/browser/extensions/api/terminal/terminal_private_api.h" }, "platforms": ["chromeos"], "description": "none", "functions": [ { "name": "openTerminalProcess", "type": "function", "description": "Starts new process.", "parameters": [ { "type": "string", "name": "processName", "description": "Name of the process to open. Initially only 'crosh' is supported. Another processes may be added in future." }, { "type": "function", "name": "callback", "optional": false, "description": "Returns pid of the launched process. If no process was launched returns -1.", "parameters": [ { "name": "pid", "description": "Pid of the launched process.", "type": "integer" } ] } ] }, { "name": "closeTerminalProcess", "type": "function", "description": "Closes previousy opened process.", "parameters": [ { "name": "pid", "type": "integer", "description": "Process id of the process we want to close." }, { "name": "callback", "type": "function", "optional": true, "description": "Function that gets called when close operation is started for the process. Returns success of the function.", "parameters": [ { "name": "success", "type": "boolean" } ] } ] }, { "name": "sendInput", "type": "function", "description": "Sends input that will be routed to stdin of the process with the specified pid.", "parameters": [ { "name": "pid", "type": "integer", "description": "The pid of the process to which we want to send input." }, { "name": "input", "type": "string", "description": "Input we are sending to the process." }, { "name": "callback", "type": "function", "optional": true, "description": "Callback that will be called when sendInput method ends. Returns success.", "parameters": [ { "name": "success", "type": "boolean" } ] } ] }, { "name": "onTerminalResize", "type": "function", "description": "Notify the process with the id pid that terminal window size has changed.", "parameters": [ { "name": "pid", "type": "integer", "description": "The pid of the process." }, { "name": "width", "type": "integer", "description": "New window width (as column count)." }, { "name": "height", "type": "integer", "description": "New window height (as row count)." }, { "name": "callback", "type": "function", "optional": true, "description": "Callback that will be called when sendInput method ends. Returns success.", "parameters": [ { "name": "success", "type": "boolean" } ] } ] } ], "events": [ { "name": "onProcessOutput", "type": "function", "description": "Fired when an opened process writes something to its output.", "parameters": [ { "name": "pid", "type": "integer", "description": "Pid of the process from which the output came." }, { "name": "type", "type": "string", "description": "Type of the output stream from which output came. When process exits, output type will be set to exit", "enum": ["stdout", "stderr", "exit"] }, { "name": "text", "type": "string", "description": "Text that was written to the output stream." } ] } ] } ]