Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(707)

Side by Side Diff: chrome/common/extensions/api/bookmarks.json

Issue 10694062: Refactor chrome.bookmarks API to use JSON schema compiler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Nits Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/common/extensions/api/api.gyp ('k') | chrome/common/extensions/docs/apps/bookmarks.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 [ 5 [
6 { 6 {
7 "namespace": "bookmarks", 7 "namespace": "bookmarks",
8 "uses_feature_system": true, 8 "uses_feature_system": true,
9 "channel": "stable", 9 "channel": "stable",
10 "dependencies": ["permission:bookmarks"], 10 "dependencies": ["permission:bookmarks"],
11 "contexts": ["blessed_extension"], 11 "contexts": ["blessed_extension"],
12 "types": [ 12 "types": [
13 { 13 {
14 "id": "BookmarkTreeNode", 14 "id": "BookmarkTreeNode",
15 "type": "object", 15 "type": "object",
16 "description": "A node (either a bookmark or a folder) in the bookmark t ree. Child nodes are ordered within their parent folder.", 16 "description": "A node (either a bookmark or a folder) in the bookmark t ree. Child nodes are ordered within their parent folder.",
17 "properties": { 17 "properties": {
18 "id": {"type": "string", "minimum": 0, "description": "The unique iden tifier for the node. IDs are unique within the current profile, and they remain valid even after the browser is restarted."}, 18 "id": {
19 "parentId": {"type": "string", "minimum": 0, "optional": true, "descri ption": "The <code>id</code> of the parent folder. Omitted for the root node."} , 19 "type": "string",
20 "index": {"type": "integer", "optional": true, "description": "The 0-b ased position of this node within its parent folder."}, 20 "minimum": 0,
21 "url": {"type": "string", "optional": true, "description": "The URL na vigated to when a user clicks the bookmark. Omitted for folders."}, 21 "description": "The unique identifier for the node. IDs are unique w ithin the current profile, and they remain valid even after the browser is resta rted."
22 "title": {"type": "string", "description": "The text displayed for the node."}, 22 },
23 "dateAdded": {"type": "number", "optional": true, "description": "When this node was created, in milliseconds since the epoch (<code>new Date(dateAdde d)</code>)."}, 23 "parentId": {
24 "dateGroupModified": {"type": "number", "optional": true, "description ": "When the contents of this folder last changed, in milliseconds since the epo ch."}, 24 "type": "string",
25 "children": {"type": "array", "optional": true, "items": {"$ref": "Boo kmarkTreeNode"}, "description": "An ordered list of children of this node."} 25 "minimum": 0,
26 "optional": true,
27 "description": "The <code>id</code> of the parent folder. Omitted f or the root node."
28 },
29 "index": {
30 "type": "integer",
31 "optional": true,
32 "description": "The 0-based position of this node within its parent folder."
33 },
34 "url": {
35 "type": "string",
36 "optional": true,
37 "description": "The URL navigated to when a user clicks the bookmark . Omitted for folders."
38 },
39 "title": {
40 "type": "string",
41 "description": "The text displayed for the node."
42 },
43 "dateAdded": {
44 "type": "number",
45 "optional": true,
46 "description": "When this node was created, in milliseconds since th e epoch (<code>new Date(dateAdded)</code>)."
47 },
48 "dateGroupModified": {
49 "type": "number",
50 "optional": true,
51 "description": "When the contents of this folder last changed, in mi lliseconds since the epoch."
52 },
53 "children": {
54 "type": "array",
55 "optional": true,
56 "items": { "$ref": "BookmarkTreeNode" },
57 "description": "An ordered list of children of this node."
58 }
26 } 59 }
27 } 60 }
28 ], 61 ],
29 "functions": [ 62 "functions": [
30 { 63 {
31 "name": "get", 64 "name": "get",
32 "type": "function", 65 "type": "function",
33 "description": "Retrieves the specified BookmarkTreeNode(s).", 66 "description": "Retrieves the specified BookmarkTreeNode(s).",
34 "parameters": [ 67 "parameters": [
35 { 68 {
36 "name": "idOrIdList", 69 "name": "idOrIdList",
37 "description": "A single string-valued id, or an array of string-val ued ids", 70 "description": "A single string-valued id, or an array of string-val ued ids",
38 "choices": [ 71 "choices": [
39 {"type": "string"}, 72 {
40 {"type": "array", "items": {"type": "string"}, "minItems": 1} 73 "type": "string",
74 "serialized_type": "int64"
75 },
76 {
77 "type": "array",
78 "items": {
79 "type": "string",
80 "serialized_type": "int64"
81 },
82 "minItems": 1
83 }
41 ] 84 ]
42 }, 85 },
43 { 86 {
44 "type": "function", 87 "type": "function",
45 "name": "callback", 88 "name": "callback",
46 "parameters": [ 89 "parameters": [
47 {"name": "results", "type": "array", "items": { "$ref": "BookmarkT reeNode"} } 90 {
91 "name": "results",
92 "type": "array",
93 "items": { "$ref": "BookmarkTreeNode" }
94 }
48 ] 95 ]
49 } 96 }
50 ] 97 ]
51 }, 98 },
52 { 99 {
53 "name": "getChildren", 100 "name": "getChildren",
54 "type": "function", 101 "type": "function",
55 "description": "Retrieves the children of the specified BookmarkTreeNode id.", 102 "description": "Retrieves the children of the specified BookmarkTreeNode id.",
56 "parameters": [ 103 "parameters": [
57 {"type": "string", "name": "id"}, 104 {
105 "type": "string",
106 "serialized_type": "int64",
107 "name": "id"
108 },
58 { 109 {
59 "type": "function", 110 "type": "function",
60 "name": "callback", 111 "name": "callback",
61 "parameters": [ 112 "parameters": [
62 {"name": "results", "type": "array", "items": { "$ref": "BookmarkT reeNode"} } 113 {
114 "name": "results",
115 "type": "array",
116 "items": { "$ref": "BookmarkTreeNode"}
117 }
63 ] 118 ]
64 } 119 }
65 ] 120 ]
66 }, 121 },
67 { 122 {
68 "name": "getRecent", 123 "name": "getRecent",
69 "type": "function", 124 "type": "function",
70 "description": "Retrieves the recently added bookmarks.", 125 "description": "Retrieves the recently added bookmarks.",
71 "parameters": [ 126 "parameters": [
72 { 127 {
73 "type": "integer", 128 "type": "integer",
74 "minimum": 1, 129 "minimum": 1,
75 "name": "numberOfItems", 130 "name": "numberOfItems",
76 "description": "The maximum number of items to return." 131 "description": "The maximum number of items to return."
77 }, 132 },
78 { 133 {
79 "type": "function", 134 "type": "function",
80 "name": "callback", 135 "name": "callback",
81 "parameters": [ 136 "parameters": [
82 {"name": "results", "type": "array", "items": { "$ref": "BookmarkT reeNode"} } 137 {
138 "name": "results",
139 "type": "array",
140 "items": { "$ref": "BookmarkTreeNode" }
141 }
83 ] 142 ]
84 } 143 }
85 ] 144 ]
86 }, 145 },
87 { 146 {
88 "name": "getTree", 147 "name": "getTree",
89 "type": "function", 148 "type": "function",
90 "description": "Retrieves the entire Bookmarks hierarchy.", 149 "description": "Retrieves the entire Bookmarks hierarchy.",
91 "parameters": [ 150 "parameters": [
92 { 151 {
93 "type": "function", 152 "type": "function",
94 "name": "callback", 153 "name": "callback",
95 "parameters": [ 154 "parameters": [
96 {"name": "results", "type": "array", "items": { "$ref": "BookmarkT reeNode"} } 155 {
156 "name": "results",
157 "type": "array",
158 "items": { "$ref": "BookmarkTreeNode" }
159 }
97 ] 160 ]
98 } 161 }
99 ] 162 ]
100 }, 163 },
101 { 164 {
102 "name": "getSubTree", 165 "name": "getSubTree",
103 "type": "function", 166 "type": "function",
104 "description": "Retrieves part of the Bookmarks hierarchy, starting at t he specified node.", 167 "description": "Retrieves part of the Bookmarks hierarchy, starting at t he specified node.",
105 "parameters": [ 168 "parameters": [
106 { 169 {
107 "type": "string", 170 "type": "string",
171 "serialized_type": "int64",
108 "name": "id", 172 "name": "id",
109 "description": "The ID of the root of the subtree to retrieve." 173 "description": "The ID of the root of the subtree to retrieve."
110 }, 174 },
111 { 175 {
112 "type": "function", 176 "type": "function",
113 "name": "callback", 177 "name": "callback",
114 "parameters": [ 178 "parameters": [
115 {"name": "results", "type": "array", "items": { "$ref": "BookmarkT reeNode"} } 179 {
180 "name": "results",
181 "type": "array",
182 "items": { "$ref": "BookmarkTreeNode" }
183 }
116 ] 184 ]
117 } 185 }
118 ] 186 ]
119 }, 187 },
120 { 188 {
121 "name": "search", 189 "name": "search",
122 "type": "function", 190 "type": "function",
123 "description": "Searches for BookmarkTreeNodes matching the given query. ", 191 "description": "Searches for BookmarkTreeNodes matching the given query. ",
124 "parameters": [ 192 "parameters": [
125 {"type": "string", "name": "query"}, 193 {
194 "type": "string",
195 "name": "query"
196 },
126 { 197 {
127 "type": "function", 198 "type": "function",
128 "name": "callback", 199 "name": "callback",
129 "parameters": [ 200 "parameters": [
130 {"name": "results", "type": "array", "items": { "$ref": "BookmarkT reeNode"} } 201 {
202 "name": "results",
203 "type": "array",
204 "items": { "$ref": "BookmarkTreeNode" }
205 }
131 ] 206 ]
132 } 207 }
133 ] 208 ]
134 }, 209 },
135 { 210 {
136 "name": "create", 211 "name": "create",
137 "type": "function", 212 "type": "function",
138 "description": "Creates a bookmark or folder under the specified parentI d. If url is NULL or missing, it will be a folder.", 213 "description": "Creates a bookmark or folder under the specified parentI d. If url is NULL or missing, it will be a folder.",
139 "parameters": [ 214 "parameters": [
140 { 215 {
141 "type": "object", 216 "type": "object",
142 "name": "bookmark", 217 "name": "bookmark",
143 "properties": { 218 "properties": {
144 "parentId": { 219 "parentId": {
145 "type": "string", 220 "type": "string",
221 "serialized_type": "int64",
146 "optional": true, 222 "optional": true,
147 "description": "Defaults to the Other Bookmarks folder."}, 223 "description": "Defaults to the Other Bookmarks folder."
148 "index": {"type": "integer", "minimum": 0, "optional": true}, 224 },
149 "title": {"type": "string", "optional": true}, 225 "index": {
150 "url": {"type": "string", "optional": true} 226 "type": "integer",
227 "minimum": 0,
228 "optional": true
229 },
230 "title": {
231 "type": "string",
232 "optional": true
233 },
234 "url": {
235 "type": "string",
236 "optional": true
237 }
151 } 238 }
152 }, 239 },
153 { 240 {
154 "type": "function", 241 "type": "function",
155 "name": "callback", 242 "name": "callback",
156 "optional": true, 243 "optional": true,
157 "parameters": [ 244 "parameters": [
158 {"name": "result", "$ref": "BookmarkTreeNode" } 245 {
246 "name": "result",
247 "$ref": "BookmarkTreeNode"
248 }
159 ] 249 ]
160 } 250 }
161 ] 251 ]
162 }, 252 },
163 { 253 {
164 "name": "move", 254 "name": "move",
165 "type": "function", 255 "type": "function",
166 "description": "Moves the specified BookmarkTreeNode to the provided loc ation.", 256 "description": "Moves the specified BookmarkTreeNode to the provided loc ation.",
167 "parameters": [ 257 "parameters": [
168 {"type": "string", "name": "id"}, 258 {
259 "type": "string",
260 "serialized_type": "int64",
261 "name": "id"
262 },
169 { 263 {
170 "type": "object", 264 "type": "object",
171 "name": "destination", 265 "name": "destination",
172 "properties": { 266 "properties": {
173 "parentId": {"type": "string"}, 267 "parentId": {
174 "index": {"type": "integer", "minimum": 0, "optional": true} 268 "type": "string",
269 "optional": true
270 },
271 "index": {
272 "type": "integer",
273 "minimum": 0,
274 "optional": true
275 }
175 } 276 }
176 }, 277 },
177 { 278 {
178 "type": "function", 279 "type": "function",
179 "name": "callback", 280 "name": "callback",
180 "optional": true, 281 "optional": true,
181 "parameters": [ 282 "parameters": [
182 {"name": "result", "$ref": "BookmarkTreeNode" } 283 {
284 "name": "result",
285 "$ref": "BookmarkTreeNode"
286 }
183 ] 287 ]
184 } 288 }
185 ] 289 ]
186 }, 290 },
187 { 291 {
188 "name": "update", 292 "name": "update",
189 "type": "function", 293 "type": "function",
190 "description": "Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. <b>Note:</b> Currently, only 'title' and 'url' are supported.", 294 "description": "Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. <b>Note:</b> Currently, only 'title' and 'url' are supported.",
191 "parameters": [ 295 "parameters": [
192 {"type": "string", "name": "id"}, 296 {
297 "type": "string",
298 "serialized_type": "int64",
299 "name": "id"
300 },
193 { 301 {
194 "type": "object", 302 "type": "object",
195 "name": "changes", 303 "name": "changes",
196 "properties": { 304 "properties": {
197 "title": {"type": "string", "optional": true}, 305 "title": {
198 "url": {"type": "string", "optional": true} 306 "type": "string",
307 "optional": true
308 },
309 "url": {
310 "type": "string",
311 "optional": true
312 }
199 } 313 }
200 }, 314 },
201 { 315 {
202 "type": "function", 316 "type": "function",
203 "name": "callback", 317 "name": "callback",
204 "optional": true, 318 "optional": true,
205 "parameters": [ 319 "parameters": [
206 {"name": "result", "$ref": "BookmarkTreeNode" } 320 {
321 "name": "result",
322 "$ref": "BookmarkTreeNode"
323 }
207 ] 324 ]
208 } 325 }
209 ] 326 ]
210 }, 327 },
211 { 328 {
212 "name": "remove", 329 "name": "remove",
213 "type": "function", 330 "type": "function",
214 "description": "Removes a bookmark or an empty bookmark folder.", 331 "description": "Removes a bookmark or an empty bookmark folder.",
215 "parameters": [ 332 "parameters": [
216 {"type": "string", "name": "id"}, 333 {
217 {"type": "function", "name": "callback", "optional": true, "parameters ": []} 334 "type": "string",
335 "serialized_type": "int64",
336 "name": "id"
337 },
338 {
339 "type": "function",
340 "name": "callback",
341 "optional": true,
342 "parameters": []
343 }
218 ] 344 ]
219 }, 345 },
220 { 346 {
221 "name": "removeTree", 347 "name": "removeTree",
222 "type": "function", 348 "type": "function",
223 "description": "Recursively removes a bookmark folder.", 349 "description": "Recursively removes a bookmark folder.",
224 "parameters": [ 350 "parameters": [
225 {"type": "string", "name": "id"}, 351 {
226 {"type": "function", "name": "callback", "optional": true, "parameters ": []} 352 "type": "string",
353 "serialized_type": "int64",
354 "name": "id"
355 },
356 {
357 "type": "function",
358 "name": "callback",
359 "optional": true,
360 "parameters": []
361 }
227 ] 362 ]
228 }, 363 },
229 { 364 {
230 "name": "import", 365 "name": "import",
231 "type": "function", 366 "type": "function",
232 "description": "Imports bookmarks from a chrome html bookmark file", 367 "description": "Imports bookmarks from a chrome html bookmark file",
233 "nodoc": "true", 368 "nodoc": "true",
234 "parameters": [ 369 "parameters": [
235 {"type": "function", "name": "callback", "optional": true, "parameters ": []} 370 {
371 "type": "function",
372 "name": "callback",
373 "optional": true,
374 "parameters": []
375 }
236 ] 376 ]
237 }, 377 },
238 { 378 {
239 "name": "export", 379 "name": "export",
240 "type": "function", 380 "type": "function",
241 "description": "Exports bookmarks to a chrome html bookmark file", 381 "description": "Exports bookmarks to a chrome html bookmark file",
242 "nodoc": "true", 382 "nodoc": "true",
243 "parameters": [ 383 "parameters": [
244 {"type": "function", "name": "callback", "optional": true, "parameters ": []} 384 {
385 "type": "function",
386 "name": "callback",
387 "optional": true,
388 "parameters": []
389 }
245 ] 390 ]
246 } 391 }
247 ], 392 ],
248 "events": [ 393 "events": [
249 { 394 {
250 "name": "onCreated", 395 "name": "onCreated",
251 "type": "function", 396 "type": "function",
252 "description": "Fired when a bookmark or folder is created.", 397 "description": "Fired when a bookmark or folder is created.",
253 "parameters": [ 398 "parameters": [
254 {"type": "string", "name": "id"}, 399 {
400 "type": "string",
401 "name": "id"
402 },
255 { 403 {
256 "$ref": "BookmarkTreeNode", 404 "$ref": "BookmarkTreeNode",
257 "name": "bookmark" 405 "name": "bookmark"
258 } 406 }
259 ] 407 ]
260 }, 408 },
261 { 409 {
262 "name": "onRemoved", 410 "name": "onRemoved",
263 "type": "function", 411 "type": "function",
264 "description": "Fired when a bookmark or folder is removed. When a fold er is removed recursively, a single notification is fired for the folder, and no ne for its contents.", 412 "description": "Fired when a bookmark or folder is removed. When a fold er is removed recursively, a single notification is fired for the folder, and no ne for its contents.",
265 "parameters": [ 413 "parameters": [
266 {"type": "string", "name": "id"}, 414 {
415 "type": "string",
416 "name": "id"
417 },
267 { 418 {
268 "type": "object", 419 "type": "object",
269 "name": "removeInfo", 420 "name": "removeInfo",
270 "properties": { 421 "properties": {
271 "parentId": { "type": "string" }, 422 "parentId": { "type": "string" },
272 "index": { "type": "integer" } 423 "index": { "type": "integer" }
273 } 424 }
274 } 425 }
275 ] 426 ]
276 }, 427 },
277 { 428 {
278 "name": "onChanged", 429 "name": "onChanged",
279 "type": "function", 430 "type": "function",
280 "description": "Fired when a bookmark or folder changes. <b>Note:</b> C urrently, only title and url changes trigger this.", 431 "description": "Fired when a bookmark or folder changes. <b>Note:</b> C urrently, only title and url changes trigger this.",
281 "parameters": [ 432 "parameters": [
282 {"type": "string", "name": "id"}, 433 {
434 "type": "string",
435 "name": "id"
436 },
283 { 437 {
284 "type": "object", 438 "type": "object",
285 "name": "changeInfo", 439 "name": "changeInfo",
286 "properties": { 440 "properties": {
287 "title": {"type": "string"}, 441 "title": { "type": "string" },
288 "url": {"type": "string", "optional": true} 442 "url": {
443 "type": "string",
444 "optional": true
445 }
289 } 446 }
290 } 447 }
291 ] 448 ]
292 }, 449 },
293 { 450 {
294 "name": "onMoved", 451 "name": "onMoved",
295 "type": "function", 452 "type": "function",
296 "description": "Fired when a bookmark or folder is moved to a different parent folder.", 453 "description": "Fired when a bookmark or folder is moved to a different parent folder.",
297 "parameters": [ 454 "parameters": [
298 {"type": "string", "name": "id"}, 455 {
456 "type": "string",
457 "name": "id"
458 },
299 { 459 {
300 "type": "object", 460 "type": "object",
301 "name": "moveInfo", 461 "name": "moveInfo",
302 "properties": { 462 "properties": {
303 "parentId": { "type": "string" }, 463 "parentId": { "type": "string" },
304 "index": { "type": "integer" }, 464 "index": { "type": "integer" },
305 "oldParentId": { "type": "string" }, 465 "oldParentId": { "type": "string" },
306 "oldIndex": { "type": "integer" } 466 "oldIndex": { "type": "integer" }
307 } 467 }
308 } 468 }
309 ] 469 ]
310 }, 470 },
311 { 471 {
312 "name": "onChildrenReordered", 472 "name": "onChildrenReordered",
313 "type": "function", 473 "type": "function",
314 "description": "Fired when the children of a folder have changed their o rder due to the order being sorted in the UI. This is not called as a result of a move().", 474 "description": "Fired when the children of a folder have changed their o rder due to the order being sorted in the UI. This is not called as a result of a move().",
315 "parameters": [ 475 "parameters": [
316 {"type": "string", "name": "id"}, 476 {
477 "type": "string",
478 "name": "id"
479 },
317 { 480 {
318 "type": "object", 481 "type": "object",
319 "name": "reorderInfo", 482 "name": "reorderInfo",
320 "properties": { 483 "properties": {
321 "childIds": { "type": "array", "items": { "type": "string" } } 484 "childIds": {
485 "type": "array",
486 "items": { "type": "string" }
487 }
322 } 488 }
323 } 489 }
324 ] 490 ]
325 }, 491 },
326 { 492 {
327 "name": "onImportBegan", 493 "name": "onImportBegan",
328 "type": "function", 494 "type": "function",
329 "description": "Fired when a bookmark import session is begun. Expensiv e observers should ignore handleCreated updates until onImportEnded is fired. O bservers should still handle other notifications immediately.", 495 "description": "Fired when a bookmark import session is begun. Expensiv e observers should ignore handleCreated updates until onImportEnded is fired. O bservers should still handle other notifications immediately.",
330 "parameters": [] 496 "parameters": []
331 }, 497 },
332 { 498 {
333 "name": "onImportEnded", 499 "name": "onImportEnded",
334 "type": "function", 500 "type": "function",
335 "description": "Fired when a bookmark import session is ended.", 501 "description": "Fired when a bookmark import session is ended.",
336 "parameters": [] 502 "parameters": []
337 } 503 }
338 ] 504 ]
339 } 505 }
340 ] 506 ]
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/api.gyp ('k') | chrome/common/extensions/docs/apps/bookmarks.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698