| OLD | NEW |
| (Empty) |
| 1 <!-- BEGIN AUTHORED CONTENT --> | |
| 2 <p id="classSummary"> | |
| 3 Use the <code>chrome.bookmarks</code> module to create, organize, | |
| 4 and otherwise manipulate bookmarks. | |
| 5 Also see <a href="override.html">Override Pages</a>, | |
| 6 which you can use to create a custom Bookmark Manager page. | |
| 7 </p> | |
| 8 <img src="{{static}}/images/bookmarks.png" | |
| 9 width="210" height="147" alt="Clicking the star adds a bookmark" /> | |
| 10 <h2 id="manifest">Manifest</h2> | |
| 11 <p>You must declare the "bookmarks" permission | |
| 12 in the <a href="manifest.html">extension manifest</a> | |
| 13 to use the bookmarks API. | |
| 14 For example:</p> | |
| 15 <pre>{ | |
| 16 "name": "My extension", | |
| 17 ... | |
| 18 <b>"permissions": [ | |
| 19 "bookmarks" | |
| 20 ]</b>, | |
| 21 ... | |
| 22 }</pre> | |
| 23 <h2 id="description">Objects and properties</h2> | |
| 24 <p> | |
| 25 Bookmarks are organized in a tree, | |
| 26 where each node in the tree | |
| 27 is either a bookmark or a folder | |
| 28 (sometimes called a <em>group</em>). | |
| 29 Each node in the tree | |
| 30 is represented by a | |
| 31 <a href="#type-bookmarks.BookmarkTreeNode"><code>BookmarkTreeNode</code></a> obj
ect. | |
| 32 </p> | |
| 33 <p> | |
| 34 <code>BookmarkTreeNode</code> properties | |
| 35 are used throughout the <code>chrome.bookmarks</code> API. | |
| 36 For example, when you call | |
| 37 <a href="#method-create"><code>create()</code></a>, | |
| 38 you pass in the new node's parent (<code>parentId</code>), | |
| 39 and, optionally, the node's | |
| 40 <code>index</code>, <code>title</code>, and <code>url</code> properties. | |
| 41 See <a href="#type-bookmarks.BookmarkTreeNode"><code>BookmarkTreeNode</code></a> | |
| 42 for information about the properties a node can have. | |
| 43 </p> | |
| 44 <p class="note"><b>Note:</b> You cannot use this API to add or remove entries | |
| 45 in the root folder. You also cannot rename, move, or remove the special | |
| 46 "Bookmarks Bar" and "Other Bookmarks" folders.</p> | |
| 47 <h2 id="overview-examples">Examples</h2> | |
| 48 <p> | |
| 49 The following code creates a folder with the title "Extension bookmarks". | |
| 50 The first argument to <code>create()</code> specifies properties | |
| 51 for the new folder. | |
| 52 The second argument defines a function | |
| 53 to be executed after the folder is created. | |
| 54 </p> | |
| 55 <pre> | |
| 56 chrome.bookmarks.create({'parentId': bookmarkBar.id, | |
| 57 'title': 'Extension bookmarks'}, | |
| 58 function(newFolder) { | |
| 59 console.log("added folder: " + newFolder.title); | |
| 60 }); | |
| 61 </pre> | |
| 62 <p> | |
| 63 The next snippet creates a bookmark pointing to | |
| 64 the developer documentation for extensions. | |
| 65 Since nothing bad will happen if creating the bookmark fails, | |
| 66 this code doesn't bother to define a callback function. | |
| 67 </p> | |
| 68 <pre> | |
| 69 chrome.bookmarks.create({'parentId': extensionsFolderId, | |
| 70 'title': 'Extensions doc', | |
| 71 'url': 'http://code.google.com/chrome/extensions'}); | |
| 72 </pre> | |
| 73 <p> | |
| 74 For an example of using this API, see the | |
| 75 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/bookmarks/basic/">basic bookmarks sample</a>. | |
| 76 For other examples and for help in viewing the source code, see | |
| 77 <a href="samples.html">Samples</a>. | |
| 78 </p> | |
| 79 <!-- END AUTHORED CONTENT --> | |
| OLD | NEW |