diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-10 15:10:55 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-10 15:10:55 +0000 |
commit | d868f62ecb4135be9f0b58e2ac19f25d16a8e7ec (patch) | |
tree | 7953c8a299f7abf631c94457d8923bcbbfe54851 /chrome/renderer/resources | |
parent | 6cb2b8005e8dbaca2273913234dda828ad51018a (diff) | |
download | chromium_src-d868f62ecb4135be9f0b58e2ac19f25d16a8e7ec.zip chromium_src-d868f62ecb4135be9f0b58e2ac19f25d16a8e7ec.tar.gz chromium_src-d868f62ecb4135be9f0b58e2ac19f25d16a8e7ec.tar.bz2 |
Clean up bookmark API to match style of other extension APIs
BUG=11823
TEST=--load-extension test/data/extensions/samples/bookmarks
TEST=unit_tests.exe --gtest_filter=ExtensionAPIClientTest.*
Review URL: http://codereview.chromium.org/118209
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18056 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/resources')
-rw-r--r-- | chrome/renderer/resources/extension_process_bindings.js | 57 | ||||
-rw-r--r-- | chrome/renderer/resources/json_schema.js | 2 |
2 files changed, 30 insertions, 29 deletions
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js index d025f7b..ea6481c 100644 --- a/chrome/renderer/resources/extension_process_bindings.js +++ b/chrome/renderer/resources/extension_process_bindings.js @@ -377,11 +377,7 @@ var chrome; }; chrome.bookmarks.get.params = [ - { - type: "array", - items: chrome.types.pInt, - optional: true - }, + chrome.types.singleOrListOf(chrome.types.pInt), chrome.types.fun ]; @@ -401,6 +397,7 @@ var chrome; }; // TODO(erikkay): allow it to take an optional id as a starting point + // BUG=13727 chrome.bookmarks.getTree.params = [ chrome.types.fun ]; @@ -415,19 +412,23 @@ var chrome; chrome.types.fun ]; - chrome.bookmarks.remove = function(bookmark, callback) { + chrome.bookmarks.remove = function(id, callback) { validate(arguments, arguments.callee.params); - sendRequest(RemoveBookmark, bookmark, callback); + sendRequest(RemoveBookmark, [id, false], callback); }; chrome.bookmarks.remove.params = [ - { - type: "object", - properties: { - id: chrome.types.pInt, - recursive: chrome.types.optBool - } - }, + chrome.types.singleOrListOf(chrome.types.pInt), + chrome.types.optFun + ]; + + chrome.bookmarks.removeTree = function(id, callback) { + validate(arguments, arguments.callee.params); + sendRequest(RemoveBookmark, [id, true], callback); + }; + + chrome.bookmarks.removeTree.params = [ + chrome.types.pInt, chrome.types.optFun ]; @@ -449,16 +450,16 @@ var chrome; chrome.types.optFun ]; - chrome.bookmarks.move = function(obj, callback) { + chrome.bookmarks.move = function(id, destination, callback) { validate(arguments, arguments.callee.params); - sendRequest(MoveBookmark, obj, callback); + sendRequest(MoveBookmark, [id, destination], callback); }; chrome.bookmarks.move.params = [ + chrome.types.pInt, { type: "object", properties: { - id: chrome.types.pInt, parentId: chrome.types.optPInt, index: chrome.types.optPInt } @@ -466,16 +467,16 @@ var chrome; chrome.types.optFun ]; - chrome.bookmarks.setTitle = function(bookmark, callback) { + chrome.bookmarks.update = function(id, changes, callback) { validate(arguments, arguments.callee.params); - sendRequest(SetBookmarkTitle, bookmark, callback); + sendRequest(SetBookmarkTitle, [id, changes], callback); }; - chrome.bookmarks.setTitle.params = [ + chrome.bookmarks.update.params = [ + chrome.types.pInt, { type: "object", properties: { - id: chrome.types.pInt, title: chrome.types.optStr } }, @@ -484,21 +485,21 @@ var chrome; // bookmark events - // Sends ({id, title, url, parentId, index}) - chrome.bookmarks.onBookmarkAdded = new chrome.Event("bookmark-added"); + // Sends (id, {title, url, parentId, index}) + chrome.bookmarks.onAdded = new chrome.Event("bookmark-added"); // Sends ({parentId, index}) - chrome.bookmarks.onBookmarkRemoved = new chrome.Event("bookmark-removed"); + chrome.bookmarks.onRemoved = new chrome.Event("bookmark-removed"); // Sends (id, object) where object has list of properties that have changed. // Currently, this only ever includes 'title'. - chrome.bookmarks.onBookmarkChanged = new chrome.Event("bookmark-changed"); + chrome.bookmarks.onChanged = new chrome.Event("bookmark-changed"); - // Sends ({id, parentId, index, oldParentId, oldIndex}) - chrome.bookmarks.onBookmarkMoved = new chrome.Event("bookmark-moved"); + // Sends (id, {parentId, index, oldParentId, oldIndex}) + chrome.bookmarks.onMoved = new chrome.Event("bookmark-moved"); // Sends (id, [childrenIds]) - chrome.bookmarks.onBookmarkChildrenReordered = + chrome.bookmarks.onChildrenReordered = new chrome.Event("bookmark-children-reordered"); diff --git a/chrome/renderer/resources/json_schema.js b/chrome/renderer/resources/json_schema.js index f8a4c7a..4973990 100644 --- a/chrome/renderer/resources/json_schema.js +++ b/chrome/renderer/resources/json_schema.js @@ -376,7 +376,7 @@ chrome.JSONSchemaValidator.prototype.addError = function(path, key, return { choice: [ type, - { type: "array", item: type } + { type: "array", item: type, minItems: 1 } ] }; }; |