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