The Chromium Projects

Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution 2.5 license, and examples are licensed under the BSD License.

The Chromium OS designs and code are preliminary. Expect them to evolve.
For Developers‎ > ‎Design Documents‎ > ‎Extensions‎ > ‎

Bookmarks API


This page is obsolete. Please see the new version at:

http://code.google.com/chrome/extensions/bookmarks.html

Overview

The bookmarks API allows you to manipulate the user's bookmarks.

Status

Partially implemented.  The API has changed from the last dev release.

Notes

Bookmark ids are only guaranteed within a single browser session.  They are not meant to be persisted.

Details

chrome.bookmarks.
    void create({[int parentId], [int index], [string title], [string url]}, [void callback(BookmarkTreeNode result)])
    void get(int[] ids | int id, void callback(BookmarkTreeNode[] results))
    void getChildren(int id, void callback(BookmarkTreeNode[] results))
    void getTree(void callback(BookmarkTreeNode[] results))
    void move(int id, {[int parentId], [int index]}, void callback())
    void remove(int[] ids | int id, void callback())
    void removeTree(int id, void callback())
    void search(string query, void callback(BookmarkTreeNode[] results))

    // Note: updating a bookmark's URL is not currently supported.
    void update(int id, {string title}, void callback(BookmarkTreeNode result)) 

    event onAdded(int id, BookmarkTreeNode node)
    event onRemoved(int id, {int parentId, int index})
    event onChanged(int id, Object changedProps)
    event onMoved(int id, {int parentId, int index, int oldParentId, int oldIndex})
    event onChildrenReordered(int id, int childrenIds[])

    struct BookmarkTreeNode {
        int id
        string title
        int parentId                    // undefined if root folder
        string url                      // undefined if folder
        BookmarkTreeNode[] children     // undefined if bookmark
        int dateAdded                   // date initially created in milliseconds since UTC epoch (midnight, jan 1, 1970)
        int dateGroupModified           // date the contents of a folder have changed (milliseconds since UTC epoch)
    }