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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extension_process_bindings.js
===================================================================
--- chrome/renderer/resources/extension_process_bindings.js (revision 14841)
+++ chrome/renderer/resources/extension_process_bindings.js (working copy)
@@ -19,6 +19,8 @@
native function MoveTab();
native function RemoveTab();
native function GetBookmarks();
+ native function GetBookmarkChildren();
+ native function GetBookmarkTree();
native function SearchBookmarks();
native function RemoveBookmark();
native function CreateBookmark();
@@ -238,35 +240,54 @@
//----------------------------------------------------------------------------
// Bookmarks
- // TODO(erikkay): Call validate() in these functions.
chromium.bookmarks = {};
chromium.bookmarks.get = function(ids, callback) {
+ validate(arguments, arguments.callee.params);
sendRequest(GetBookmarks, ids, callback);
};
chromium.bookmarks.get.params = [
{
type: "array",
- items: {
- type: chromium.types.pInt
- },
- minItems: 1,
+ items: chromium.types.pInt,
optional: true
},
- chromium.types.optFun
+ chromium.types.fun
];
+
+ chromium.bookmarks.getChildren = function(id, callback) {
+ validate(arguments, arguments.callee.params);
+ sendRequest(GetBookmarkChildren, id, callback);
+ };
+ chromium.bookmarks.getChildren.params = [
+ chromium.types.pInt,
+ chromium.types.fun
+ ];
+
+ chromium.bookmarks.getTree = function(callback) {
+ validate(arguments, arguments.callee.params);
+ sendRequest(GetBookmarkTree, null, callback);
+ };
+
+ // TODO(erikkay): allow it to take an optional id as a starting point
+ chromium.bookmarks.getTree.params = [
+ chromium.types.fun
+ ];
+
chromium.bookmarks.search = function(query, callback) {
+ validate(arguments, arguments.callee.params);
sendRequest(SearchBookmarks, query, callback);
};
chromium.bookmarks.search.params = [
- chromium.types.string,
- chromium.types.optFun
+ chromium.types.str,
+ chromium.types.fun
];
chromium.bookmarks.remove = function(bookmark, callback) {
+ validate(arguments, arguments.callee.params);
sendRequest(RemoveBookmark, bookmark, callback);
};
@@ -275,13 +296,14 @@
type: "object",
properties: {
id: chromium.types.pInt,
- recursive: chromium.types.bool
+ recursive: chromium.types.optBool
}
},
chromium.types.optFun
];
chromium.bookmarks.create = function(bookmark, callback) {
+ validate(arguments, arguments.callee.params);
sendRequest(CreateBookmark, bookmark, callback);
};
@@ -291,14 +313,15 @@
properties: {
parentId: chromium.types.optPInt,
index: chromium.types.optPInt,
- title: chromium.types.optString,
- url: chromium.types.optString,
+ title: chromium.types.optStr,
+ url: chromium.types.optStr,
}
},
chromium.types.optFun
];
chromium.bookmarks.move = function(obj, callback) {
+ validate(arguments, arguments.callee.params);
sendRequest(MoveBookmark, obj, callback);
};
@@ -315,6 +338,7 @@
];
chromium.bookmarks.setTitle = function(bookmark, callback) {
+ validate(arguments, arguments.callee.params);
sendRequest(SetBookmarkTitle, bookmark, callback);
};
@@ -323,12 +347,32 @@
type: "object",
properties: {
id: chromium.types.pInt,
- title: chromium.types.optString
+ title: chromium.types.optStr
}
},
chromium.types.optFun
];
+
+ // bookmark events
+
+ // Sends ({id, title, url, parentId, index})
+ chromium.bookmarks.onBookmarkAdded = new chromium.Event("bookmark-added");
+
+ // Sends ({parentId, index})
+ chromium.bookmarks.onBookmarkRemoved = new chromium.Event("bookmark-removed");
+
+ // Sends (id, object) where object has list of properties that have changed.
+ // Currently, this only ever includes 'title'.
+ chromium.bookmarks.onBookmarkChanged = new chromium.Event("bookmark-changed");
+
+ // Sends ({id, parentId, index, oldParentId, oldIndex})
+ chromium.bookmarks.onBookmarkMoved = new chromium.Event("bookmark-moved");
+ // Sends (id, [childrenIds])
+ chromium.bookmarks.onBookmarkChildrenReordered =
+ new chromium.Event("bookmark-children-reordered");
+
+
//----------------------------------------------------------------------------
// Self
« 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