- add sources.
[platform/framework/web/crosswalk.git] / src / tools / json_schema_compiler / test / browser_action.json
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": "browserAction",
8     "description": "The browserAction API.",
9     "dependencies": [ "tabs" ],
10     "types": [
11       {
12         "id": "ColorArray",
13         "type": "array",
14         "items": {
15           "type": "integer",
16           "minimum": 0,
17           "maximum": 255
18         },
19         "minItems": 4,
20         "maxItems": 4
21       }
22     ],
23     "functions": [
24       {
25         "name": "setTitle",
26         "type": "function",
27         "description": "Sets the title of the browser action. This shows up in the tooltip.",
28         "parameters": [
29           {
30             "name": "details",
31             "type": "object",
32             "properties": {
33               "title": {
34                 "type": "string",
35                 "description": "The string the browser action should display when moused over."
36               },
37               "tabId": {
38                 "type": "integer",
39                 "optional": true,
40                 "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
41               }
42             }
43           }
44         ]
45       },
46       {
47         "name": "getTitle",
48         "type": "function",
49         "description": "Gets the title of the browser action.",
50         "parameters": [
51           {
52             "name": "details",
53             "type": "object",
54             "properties": {
55               "tabId": {
56                 "type": "integer",
57                 "optional": true,
58                 "description": "Specify the tab to get the title from. If no tab is specified, the non-tab-specific title is returned."
59               }
60             }
61           },
62           {
63             "type": "function",
64             "name": "callback",
65             "parameters": [
66               {
67                 "name": "result",
68                 "type": "string"
69               }
70             ]
71           }
72         ]
73       },
74       {
75         "name": "setIcon",
76         "type": "function",
77         "description": "Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element. Either the <b>path</b> or the <b>imageData</b> property must be specified.",
78         "parameters": [
79           {
80             "name": "details",
81             "type": "object",
82             "properties": {
83               "imageData": {
84                 "type": "object",
85                 "isInstanceOf": "ImageData",
86                 "additionalProperties": { "type": "any" },
87                 "description": "Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element).",
88                 "optional": true
89               },
90               "path": {
91                 "type": "string",
92                 "description": "Relative path to an image in the extension to show in the browser action.",
93                 "optional": true
94               },
95               "tabId": {
96                 "type": "integer",
97                 "optional": true,
98                 "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
99               }
100             }
101           }
102         ]
103       },
104       {
105         "name": "setPopup",
106         "type": "function",
107         "description": "Sets the html document to be opened as a popup when the user clicks on the browser action's icon.",
108         "parameters": [
109           {
110             "name": "details",
111             "type": "object",
112             "properties": {
113               "tabId": {
114                 "type": "integer",
115                 "optional": true,
116                 "minimum": 0,
117                 "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
118               },
119               "popup": {
120                 "type": "string",
121                 "description": "The html file to show in a popup.  If set to the empty string (''), no popup is shown."
122               }
123             }
124           }
125         ]
126       },
127       {
128         "name": "getPopup",
129         "type": "function",
130         "description": "Gets the html document set as the popup for this browser action.",
131         "parameters": [
132           {
133             "name": "details",
134             "type": "object",
135             "properties": {
136               "tabId": {
137                 "type": "integer",
138                 "optional": true,
139                 "description": "Specify the tab to get the popup from. If no tab is specified, the non-tab-specific popup is returned."
140               }
141             }
142           },
143           {
144             "type": "function",
145             "name": "callback",
146             "parameters": [
147               {
148                 "name": "result",
149                 "type": "string"
150               }
151             ]
152           }
153         ]
154       },
155       {
156         "name": "setBadgeText",
157         "type": "function",
158         "description": "Sets the badge text for the browser action. The badge is displayed on top of the icon.",
159         "parameters": [
160           {
161             "name": "details",
162             "type": "object",
163             "properties": {
164               "text": {
165                 "type": "string",
166                 "description": "Any number of characters can be passed, but only about four can fit in the space."
167               },
168               "tabId": {
169                 "type": "integer",
170                 "optional": true,
171                 "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
172               }
173             }
174           }
175         ]
176       },
177       {
178         "name": "getBadgeText",
179         "type": "function",
180         "description": "Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned.",
181         "parameters": [
182           {
183             "name": "details",
184             "type": "object",
185             "properties": {
186               "tabId": {
187                 "type": "integer",
188                 "optional": true,
189                 "description": "Specify the tab to get the badge text from. If no tab is specified, the non-tab-specific badge text is returned."
190               }
191             }
192           },
193           {
194             "type": "function",
195             "name": "callback",
196             "parameters": [
197               {
198                 "name": "result",
199                 "type": "string"
200               }
201             ]
202           }
203         ]
204       },
205       {
206         "name": "setBadgeBackgroundColor",
207         "type": "function",
208         "description": "Sets the background color for the badge.",
209         "parameters": [
210           {
211             "name": "details",
212             "type": "object",
213             "properties": {
214               "color": {
215                 "description": "An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is <code>[255, 0, 0, 255]</code>. Can also be a string with a CSS value, with opaque red being <code>#FF0000</code> or <code>#F00</code>.",
216                 "choices": [
217                   {"type": "string"},
218                   {"$ref": "ColorArray"}
219                 ]
220               },
221               "tabId": {
222                 "type": "integer",
223                 "optional": true,
224                 "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
225               }
226             }
227           }
228         ]
229       },
230       {
231         "name": "getBadgeBackgroundColor",
232         "type": "function",
233         "description": "Gets the background color of the browser action.",
234         "parameters": [
235           {
236             "name": "details",
237             "type": "object",
238             "properties": {
239               "tabId": {
240                 "type": "integer",
241                 "optional": true,
242                 "description": "Specify the tab to get the badge background color from. If no tab is specified, the non-tab-specific badge background color is returned."
243               }
244             }
245           },
246           {
247             "type": "function",
248             "name": "callback",
249             "parameters": [
250               {
251                 "name": "result",
252                 "$ref": "ColorArray"
253               }
254             ]
255           }
256         ]
257       }
258     ],
259     "events": [
260       {
261         "name": "onClicked",
262         "type": "function",
263         "description": "Fired when a browser action icon is clicked.  This event will not fire if the browser action has a popup.",
264         "parameters": [
265           {
266             "name": "tab",
267             "$ref": "Tab"
268           }
269         ]
270       }
271     ]
272   }
273 ]