bookmarks.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. // This file was generated by:
  5. // tools/json_schema_compiler/compiler.py.
  6. // NOTE: The format of types has changed. 'FooType' is now
  7. // 'chrome.bookmarks.FooType'.
  8. // Please run the closure compiler before committing changes.
  9. // See https://chromium.googlesource.com/chromium/src/+/main/docs/closure_compilation.md
  10. /** @fileoverview Externs generated from namespace: bookmarks */
  11. /** @const */
  12. chrome.bookmarks = {};
  13. /**
  14. * @enum {string}
  15. * @see https://developer.chrome.com/extensions/bookmarks#type-BookmarkTreeNodeUnmodifiable
  16. */
  17. chrome.bookmarks.BookmarkTreeNodeUnmodifiable = {
  18. MANAGED: 'managed',
  19. };
  20. /**
  21. * A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder.
  22. * @typedef {{
  23. * id: string,
  24. * parentId: (string|undefined),
  25. * index: (number|undefined),
  26. * url: (string|undefined),
  27. * title: string,
  28. * dateAdded: (number|undefined),
  29. * dateGroupModified: (number|undefined),
  30. * unmodifiable: (!chrome.bookmarks.BookmarkTreeNodeUnmodifiable|undefined),
  31. * children: (!Array<!chrome.bookmarks.BookmarkTreeNode>|undefined)
  32. * }}
  33. * @see https://developer.chrome.com/extensions/bookmarks#type-BookmarkTreeNode
  34. */
  35. chrome.bookmarks.BookmarkTreeNode;
  36. /**
  37. * Object passed to the create() function.
  38. * @typedef {{
  39. * parentId: (string|undefined),
  40. * index: (number|undefined),
  41. * title: (string|undefined),
  42. * url: (string|undefined)
  43. * }}
  44. * @see https://developer.chrome.com/extensions/bookmarks#type-CreateDetails
  45. */
  46. chrome.bookmarks.CreateDetails;
  47. /**
  48. * @type {number}
  49. * @see https://developer.chrome.com/extensions/bookmarks#type-MAX_WRITE_OPERATIONS_PER_HOUR
  50. */
  51. chrome.bookmarks.MAX_WRITE_OPERATIONS_PER_HOUR;
  52. /**
  53. * @type {number}
  54. * @see https://developer.chrome.com/extensions/bookmarks#type-MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE
  55. */
  56. chrome.bookmarks.MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE;
  57. /**
  58. * Retrieves the specified BookmarkTreeNode(s).
  59. * @param {(string|!Array<string>)} idOrIdList A single string-valued id, or an
  60. * array of string-valued ids
  61. * @param {function(!Array<!chrome.bookmarks.BookmarkTreeNode>): void} callback
  62. * @see https://developer.chrome.com/extensions/bookmarks#method-get
  63. */
  64. chrome.bookmarks.get = function(idOrIdList, callback) {};
  65. /**
  66. * Retrieves the children of the specified BookmarkTreeNode id.
  67. * @param {string} id
  68. * @param {function(!Array<!chrome.bookmarks.BookmarkTreeNode>): void} callback
  69. * @see https://developer.chrome.com/extensions/bookmarks#method-getChildren
  70. */
  71. chrome.bookmarks.getChildren = function(id, callback) {};
  72. /**
  73. * Retrieves the recently added bookmarks.
  74. * @param {number} numberOfItems The maximum number of items to return.
  75. * @param {function(!Array<!chrome.bookmarks.BookmarkTreeNode>): void} callback
  76. * @see https://developer.chrome.com/extensions/bookmarks#method-getRecent
  77. */
  78. chrome.bookmarks.getRecent = function(numberOfItems, callback) {};
  79. /**
  80. * Retrieves the entire Bookmarks hierarchy.
  81. * @param {function(!Array<!chrome.bookmarks.BookmarkTreeNode>): void} callback
  82. * @see https://developer.chrome.com/extensions/bookmarks#method-getTree
  83. */
  84. chrome.bookmarks.getTree = function(callback) {};
  85. /**
  86. * Retrieves part of the Bookmarks hierarchy, starting at the specified node.
  87. * @param {string} id The ID of the root of the subtree to retrieve.
  88. * @param {function(!Array<!chrome.bookmarks.BookmarkTreeNode>): void} callback
  89. * @see https://developer.chrome.com/extensions/bookmarks#method-getSubTree
  90. */
  91. chrome.bookmarks.getSubTree = function(id, callback) {};
  92. /**
  93. * Searches for BookmarkTreeNodes matching the given query. Queries specified
  94. * with an object produce BookmarkTreeNodes matching all specified properties.
  95. * @param {(string|{
  96. * query: (string|undefined),
  97. * url: (string|undefined),
  98. * title: (string|undefined)
  99. * })} query Either a string of words and quoted phrases that are matched
  100. * against bookmark URLs and titles, or an object. If an object, the
  101. * properties <code>query</code>, <code>url</code>, and <code>title</code>
  102. * may be specified and bookmarks matching all specified properties will be
  103. * produced.
  104. * @param {function(!Array<!chrome.bookmarks.BookmarkTreeNode>): void} callback
  105. * @see https://developer.chrome.com/extensions/bookmarks#method-search
  106. */
  107. chrome.bookmarks.search = function(query, callback) {};
  108. /**
  109. * Creates a bookmark or folder under the specified parentId. If url is NULL or
  110. * missing, it will be a folder.
  111. * @param {!chrome.bookmarks.CreateDetails} bookmark
  112. * @param {function(!chrome.bookmarks.BookmarkTreeNode): void=} callback
  113. * @see https://developer.chrome.com/extensions/bookmarks#method-create
  114. */
  115. chrome.bookmarks.create = function(bookmark, callback) {};
  116. /**
  117. * Moves the specified BookmarkTreeNode to the provided location.
  118. * @param {string} id
  119. * @param {{
  120. * parentId: (string|undefined),
  121. * index: (number|undefined)
  122. * }} destination
  123. * @param {function(!chrome.bookmarks.BookmarkTreeNode): void=} callback
  124. * @see https://developer.chrome.com/extensions/bookmarks#method-move
  125. */
  126. chrome.bookmarks.move = function(id, destination, callback) {};
  127. /**
  128. * Updates the properties of a bookmark or folder. Specify only the properties
  129. * that you want to change; unspecified properties will be left unchanged.
  130. * <b>Note:</b> Currently, only 'title' and 'url' are supported.
  131. * @param {string} id
  132. * @param {{
  133. * title: (string|undefined),
  134. * url: (string|undefined)
  135. * }} changes
  136. * @param {function(!chrome.bookmarks.BookmarkTreeNode): void=} callback
  137. * @see https://developer.chrome.com/extensions/bookmarks#method-update
  138. */
  139. chrome.bookmarks.update = function(id, changes, callback) {};
  140. /**
  141. * Removes a bookmark or an empty bookmark folder.
  142. * @param {string} id
  143. * @param {function(): void=} callback
  144. * @see https://developer.chrome.com/extensions/bookmarks#method-remove
  145. */
  146. chrome.bookmarks.remove = function(id, callback) {};
  147. /**
  148. * Recursively removes a bookmark folder.
  149. * @param {string} id
  150. * @param {function(): void=} callback
  151. * @see https://developer.chrome.com/extensions/bookmarks#method-removeTree
  152. */
  153. chrome.bookmarks.removeTree = function(id, callback) {};
  154. /**
  155. * Imports bookmarks from a Chrome html bookmark file
  156. * @param {function(): void=} callback
  157. * @see https://developer.chrome.com/extensions/bookmarks#method-import
  158. */
  159. chrome.bookmarks.import = function(callback) {};
  160. /**
  161. * Exports bookmarks to a Chrome html bookmark file
  162. * @param {function(): void=} callback
  163. * @see https://developer.chrome.com/extensions/bookmarks#method-export
  164. */
  165. chrome.bookmarks.export = function(callback) {};
  166. /**
  167. * Fired when a bookmark or folder is created.
  168. * @type {!ChromeEvent}
  169. * @see https://developer.chrome.com/extensions/bookmarks#event-onCreated
  170. */
  171. chrome.bookmarks.onCreated;
  172. /**
  173. * Fired when a bookmark or folder is removed. When a folder is removed
  174. * recursively, a single notification is fired for the folder, and none for its
  175. * contents.
  176. * @type {!ChromeEvent}
  177. * @see https://developer.chrome.com/extensions/bookmarks#event-onRemoved
  178. */
  179. chrome.bookmarks.onRemoved;
  180. /**
  181. * Fired when a bookmark or folder changes. <b>Note:</b> Currently, only title
  182. * and url changes trigger this.
  183. * @type {!ChromeEvent}
  184. * @see https://developer.chrome.com/extensions/bookmarks#event-onChanged
  185. */
  186. chrome.bookmarks.onChanged;
  187. /**
  188. * Fired when a bookmark or folder is moved to a different parent folder.
  189. * @type {!ChromeEvent}
  190. * @see https://developer.chrome.com/extensions/bookmarks#event-onMoved
  191. */
  192. chrome.bookmarks.onMoved;
  193. /**
  194. * Fired when the children of a folder have changed their order due to the order
  195. * being sorted in the UI. This is not called as a result of a move().
  196. * @type {!ChromeEvent}
  197. * @see https://developer.chrome.com/extensions/bookmarks#event-onChildrenReordered
  198. */
  199. chrome.bookmarks.onChildrenReordered;
  200. /**
  201. * Fired when a bookmark import session is begun. Expensive observers should
  202. * ignore onCreated updates until onImportEnded is fired. Observers should
  203. * still handle other notifications immediately.
  204. * @type {!ChromeEvent}
  205. * @see https://developer.chrome.com/extensions/bookmarks#event-onImportBegan
  206. */
  207. chrome.bookmarks.onImportBegan;
  208. /**
  209. * Fired when a bookmark import session is ended.
  210. * @type {!ChromeEvent}
  211. * @see https://developer.chrome.com/extensions/bookmarks#event-onImportEnded
  212. */
  213. chrome.bookmarks.onImportEnded;