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": "terminalPrivate", 8 "compiler_options": { 9 "implemented_in": "chrome/browser/extensions/api/terminal/terminal_private_api.h" 10 }, 11 "platforms": ["chromeos"], 12 "description": "none", 13 "functions": [ 14 { 15 "name": "openTerminalProcess", 16 "type": "function", 17 "description": "Starts new process.", 18 "parameters": [ 19 { 20 "type": "string", 21 "name": "processName", 22 "description": "Name of the process to open. Initially only 'crosh' is supported. Another processes may be added in future." 23 }, 24 { 25 "type": "function", 26 "name": "callback", 27 "optional": false, 28 "description": "Returns pid of the launched process. If no process was launched returns -1.", 29 "parameters": [ 30 { 31 "name": "pid", 32 "description": "Pid of the launched process.", 33 "type": "integer" 34 } 35 ] 36 } 37 ] 38 }, 39 { 40 "name": "closeTerminalProcess", 41 "type": "function", 42 "description": "Closes previousy opened process.", 43 "parameters": [ 44 { 45 "name": "pid", 46 "type": "integer", 47 "description": "Process id of the process we want to close." 48 }, 49 { 50 "name": "callback", 51 "type": "function", 52 "optional": true, 53 "description": "Function that gets called when close operation is started for the process. Returns success of the function.", 54 "parameters": [ 55 { 56 "name": "success", 57 "type": "boolean" 58 } 59 ] 60 } 61 ] 62 }, 63 { 64 "name": "sendInput", 65 "type": "function", 66 "description": "Sends input that will be routed to stdin of the process with the specified pid.", 67 "parameters": [ 68 { 69 "name": "pid", 70 "type": "integer", 71 "description": "The pid of the process to which we want to send input." 72 }, 73 { 74 "name": "input", 75 "type": "string", 76 "description": "Input we are sending to the process." 77 }, 78 { 79 "name": "callback", 80 "type": "function", 81 "optional": true, 82 "description": "Callback that will be called when sendInput method ends. Returns success.", 83 "parameters": [ 84 { 85 "name": "success", 86 "type": "boolean" 87 } 88 ] 89 } 90 ] 91 }, 92 { 93 "name": "onTerminalResize", 94 "type": "function", 95 "description": "Notify the process with the id pid that terminal window size has changed.", 96 "parameters": [ 97 { 98 "name": "pid", 99 "type": "integer", 100 "description": "The pid of the process." 101 }, 102 { 103 "name": "width", 104 "type": "integer", 105 "description": "New window width (as column count)." 106 }, 107 { 108 "name": "height", 109 "type": "integer", 110 "description": "New window height (as row count)." 111 }, 112 { 113 "name": "callback", 114 "type": "function", 115 "optional": true, 116 "description": "Callback that will be called when sendInput method ends. Returns success.", 117 "parameters": [ 118 { 119 "name": "success", 120 "type": "boolean" 121 } 122 ] 123 } 124 ] 125 } 126 ], 127 "events": [ 128 { 129 "name": "onProcessOutput", 130 "type": "function", 131 "description": "Fired when an opened process writes something to its output.", 132 "parameters": [ 133 { 134 "name": "pid", 135 "type": "integer", 136 "description": "Pid of the process from which the output came." 137 }, 138 { 139 "name": "type", 140 "type": "string", 141 "description": "Type of the output stream from which output came. When process exits, output type will be set to exit", 142 "enum": ["stdout", "stderr", "exit"] 143 }, 144 { 145 "name": "text", 146 "type": "string", 147 "description": "Text that was written to the output stream." 148 } 149 ] 150 } 151 ] 152 } 153 ] 154