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

Side by Side Diff: chrome/renderer/resources/extension_process_bindings.js

Issue 102009: more extensions bookmarks changes:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // NOTE: If you change this file you need to touch renderer_resources.grd to 6 // NOTE: If you change this file you need to touch renderer_resources.grd to
7 // have your change take effect. 7 // have your change take effect.
8 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
9 9
10 var chromium; 10 var chromium;
11 (function() { 11 (function() {
12 native function GetNextCallbackId(); 12 native function GetNextCallbackId();
13 native function CreateWindow(); 13 native function CreateWindow();
14 native function GetWindows(); 14 native function GetWindows();
15 native function GetTabsForWindow(); 15 native function GetTabsForWindow();
16 native function GetTab(); 16 native function GetTab();
17 native function CreateTab(); 17 native function CreateTab();
18 native function UpdateTab(); 18 native function UpdateTab();
19 native function MoveTab(); 19 native function MoveTab();
20 native function RemoveTab(); 20 native function RemoveTab();
21 native function GetBookmarks(); 21 native function GetBookmarks();
22 native function GetBookmarkChildren();
23 native function GetBookmarkTree();
22 native function SearchBookmarks(); 24 native function SearchBookmarks();
23 native function RemoveBookmark(); 25 native function RemoveBookmark();
24 native function CreateBookmark(); 26 native function CreateBookmark();
25 native function MoveBookmark(); 27 native function MoveBookmark();
26 native function SetBookmarkTitle(); 28 native function SetBookmarkTitle();
27 29
28 if (!chromium) 30 if (!chromium)
29 chromium = {}; 31 chromium = {};
30 32
31 // Validate arguments. 33 // Validate arguments.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 chromium.tabs.onTabDetached = new chromium.Event("tab-detached"); 233 chromium.tabs.onTabDetached = new chromium.Event("tab-detached");
232 234
233 // sends (tabId). 235 // sends (tabId).
234 // *WILL* be followed by tab-selection-changed. 236 // *WILL* be followed by tab-selection-changed.
235 // will *NOT* be followed or preceded by tab-detached. 237 // will *NOT* be followed or preceded by tab-detached.
236 chromium.tabs.onTabRemoved = new chromium.Event("tab-removed"); 238 chromium.tabs.onTabRemoved = new chromium.Event("tab-removed");
237 239
238 //---------------------------------------------------------------------------- 240 //----------------------------------------------------------------------------
239 241
240 // Bookmarks 242 // Bookmarks
241 // TODO(erikkay): Call validate() in these functions.
242 chromium.bookmarks = {}; 243 chromium.bookmarks = {};
243 244
244 chromium.bookmarks.get = function(ids, callback) { 245 chromium.bookmarks.get = function(ids, callback) {
246 validate(arguments, arguments.callee.params);
245 sendRequest(GetBookmarks, ids, callback); 247 sendRequest(GetBookmarks, ids, callback);
246 }; 248 };
247 249
248 chromium.bookmarks.get.params = [ 250 chromium.bookmarks.get.params = [
249 { 251 {
250 type: "array", 252 type: "array",
251 items: { 253 items: chromium.types.pInt,
252 type: chromium.types.pInt
253 },
254 minItems: 1,
255 optional: true 254 optional: true
256 }, 255 },
257 chromium.types.optFun 256 chromium.types.fun
257 ];
258
259 chromium.bookmarks.getChildren = function(id, callback) {
260 validate(arguments, arguments.callee.params);
261 sendRequest(GetBookmarkChildren, id, callback);
262 };
263
264 chromium.bookmarks.getChildren.params = [
265 chromium.types.pInt,
266 chromium.types.fun
267 ];
268
269 chromium.bookmarks.getTree = function(callback) {
270 validate(arguments, arguments.callee.params);
271 sendRequest(GetBookmarkTree, null, callback);
272 };
273
274 // TODO(erikkay): allow it to take an optional id as a starting point
275 chromium.bookmarks.getTree.params = [
276 chromium.types.fun
258 ]; 277 ];
259 278
260 chromium.bookmarks.search = function(query, callback) { 279 chromium.bookmarks.search = function(query, callback) {
280 validate(arguments, arguments.callee.params);
261 sendRequest(SearchBookmarks, query, callback); 281 sendRequest(SearchBookmarks, query, callback);
262 }; 282 };
263 283
264 chromium.bookmarks.search.params = [ 284 chromium.bookmarks.search.params = [
265 chromium.types.string, 285 chromium.types.str,
266 chromium.types.optFun 286 chromium.types.fun
267 ]; 287 ];
268 288
269 chromium.bookmarks.remove = function(bookmark, callback) { 289 chromium.bookmarks.remove = function(bookmark, callback) {
290 validate(arguments, arguments.callee.params);
270 sendRequest(RemoveBookmark, bookmark, callback); 291 sendRequest(RemoveBookmark, bookmark, callback);
271 }; 292 };
272 293
273 chromium.bookmarks.remove.params = [ 294 chromium.bookmarks.remove.params = [
274 { 295 {
275 type: "object", 296 type: "object",
276 properties: { 297 properties: {
277 id: chromium.types.pInt, 298 id: chromium.types.pInt,
278 recursive: chromium.types.bool 299 recursive: chromium.types.optBool
279 } 300 }
280 }, 301 },
281 chromium.types.optFun 302 chromium.types.optFun
282 ]; 303 ];
283 304
284 chromium.bookmarks.create = function(bookmark, callback) { 305 chromium.bookmarks.create = function(bookmark, callback) {
306 validate(arguments, arguments.callee.params);
285 sendRequest(CreateBookmark, bookmark, callback); 307 sendRequest(CreateBookmark, bookmark, callback);
286 }; 308 };
287 309
288 chromium.bookmarks.create.params = [ 310 chromium.bookmarks.create.params = [
289 { 311 {
290 type: "object", 312 type: "object",
291 properties: { 313 properties: {
292 parentId: chromium.types.optPInt, 314 parentId: chromium.types.optPInt,
293 index: chromium.types.optPInt, 315 index: chromium.types.optPInt,
294 title: chromium.types.optString, 316 title: chromium.types.optStr,
295 url: chromium.types.optString, 317 url: chromium.types.optStr,
296 } 318 }
297 }, 319 },
298 chromium.types.optFun 320 chromium.types.optFun
299 ]; 321 ];
300 322
301 chromium.bookmarks.move = function(obj, callback) { 323 chromium.bookmarks.move = function(obj, callback) {
324 validate(arguments, arguments.callee.params);
302 sendRequest(MoveBookmark, obj, callback); 325 sendRequest(MoveBookmark, obj, callback);
303 }; 326 };
304 327
305 chromium.bookmarks.move.params = [ 328 chromium.bookmarks.move.params = [
306 { 329 {
307 type: "object", 330 type: "object",
308 properties: { 331 properties: {
309 id: chromium.types.pInt, 332 id: chromium.types.pInt,
310 parentId: chromium.types.optPInt, 333 parentId: chromium.types.optPInt,
311 index: chromium.types.optPInt 334 index: chromium.types.optPInt
312 } 335 }
313 }, 336 },
314 chromium.types.optFun 337 chromium.types.optFun
315 ]; 338 ];
316 339
317 chromium.bookmarks.setTitle = function(bookmark, callback) { 340 chromium.bookmarks.setTitle = function(bookmark, callback) {
341 validate(arguments, arguments.callee.params);
318 sendRequest(SetBookmarkTitle, bookmark, callback); 342 sendRequest(SetBookmarkTitle, bookmark, callback);
319 }; 343 };
320 344
321 chromium.bookmarks.setTitle.params = [ 345 chromium.bookmarks.setTitle.params = [
322 { 346 {
323 type: "object", 347 type: "object",
324 properties: { 348 properties: {
325 id: chromium.types.pInt, 349 id: chromium.types.pInt,
326 title: chromium.types.optString 350 title: chromium.types.optStr
327 } 351 }
328 }, 352 },
329 chromium.types.optFun 353 chromium.types.optFun
330 ]; 354 ];
355
356 // bookmark events
357
358 // Sends ({id, title, url, parentId, index})
359 chromium.bookmarks.onBookmarkAdded = new chromium.Event("bookmark-added");
360
361 // Sends ({parentId, index})
362 chromium.bookmarks.onBookmarkRemoved = new chromium.Event("bookmark-removed");
363
364 // Sends (id, object) where object has list of properties that have changed.
365 // Currently, this only ever includes 'title'.
366 chromium.bookmarks.onBookmarkChanged = new chromium.Event("bookmark-changed");
367
368 // Sends ({id, parentId, index, oldParentId, oldIndex})
369 chromium.bookmarks.onBookmarkMoved = new chromium.Event("bookmark-moved");
331 370
371 // Sends (id, [childrenIds])
372 chromium.bookmarks.onBookmarkChildrenReordered =
373 new chromium.Event("bookmark-children-reordered");
374
375
332 //---------------------------------------------------------------------------- 376 //----------------------------------------------------------------------------
333 377
334 // Self 378 // Self
335 chromium.self = {}; 379 chromium.self = {};
336 chromium.self.onConnect = new chromium.Event("channel-connect"); 380 chromium.self.onConnect = new chromium.Event("channel-connect");
337 })(); 381 })();
338 382
OLDNEW
« no previous file with comments | « chrome/renderer/renderer_resources.grd ('k') | chrome/test/data/extensions/bookmarks/bookmark_api.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698