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