OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Module for functions which produce action objects. These are | 6 * @fileoverview Module for functions which produce action objects. These are |
7 * listed in one place to document available actions and their parameters. | 7 * listed in one place to document available actions and their parameters. |
8 */ | 8 */ |
9 | 9 |
10 cr.define('bookmarks.actions', function() { | 10 cr.define('bookmarks.actions', function() { |
11 /** | 11 /** |
12 * @param {string} id | 12 * @param {string} id |
| 13 * @param {BookmarkTreeNode} treeNode |
| 14 */ |
| 15 function createBookmark(id, treeNode) { |
| 16 return { |
| 17 name: 'create-bookmark', |
| 18 id: id, |
| 19 parentId: treeNode.parentId, |
| 20 parentIndex: treeNode.index, |
| 21 node: bookmarks.util.normalizeNode(treeNode), |
| 22 }; |
| 23 } |
| 24 |
| 25 /** |
| 26 * @param {string} id |
13 * @param {{title: string, url: (string|undefined)}} changeInfo | 27 * @param {{title: string, url: (string|undefined)}} changeInfo |
14 * @return {!Action} | 28 * @return {!Action} |
15 */ | 29 */ |
16 function editBookmark(id, changeInfo) { | 30 function editBookmark(id, changeInfo) { |
17 return { | 31 return { |
18 name: 'edit-bookmark', | 32 name: 'edit-bookmark', |
19 id: id, | 33 id: id, |
20 changeInfo: changeInfo, | 34 changeInfo: changeInfo, |
21 }; | 35 }; |
22 } | 36 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 function setSearchResults(ids) { | 171 function setSearchResults(ids) { |
158 return { | 172 return { |
159 name: 'finish-search', | 173 name: 'finish-search', |
160 results: ids, | 174 results: ids, |
161 }; | 175 }; |
162 } | 176 } |
163 | 177 |
164 return { | 178 return { |
165 changeFolderOpen: changeFolderOpen, | 179 changeFolderOpen: changeFolderOpen, |
166 clearSearch: clearSearch, | 180 clearSearch: clearSearch, |
| 181 createBookmark: createBookmark, |
167 editBookmark: editBookmark, | 182 editBookmark: editBookmark, |
168 moveBookmark: moveBookmark, | 183 moveBookmark: moveBookmark, |
169 refreshNodes: refreshNodes, | 184 refreshNodes: refreshNodes, |
170 removeBookmark: removeBookmark, | 185 removeBookmark: removeBookmark, |
171 selectFolder: selectFolder, | 186 selectFolder: selectFolder, |
172 selectItem: selectItem, | 187 selectItem: selectItem, |
173 setSearchResults: setSearchResults, | 188 setSearchResults: setSearchResults, |
174 setSearchTerm: setSearchTerm, | 189 setSearchTerm: setSearchTerm, |
175 }; | 190 }; |
176 }); | 191 }); |
OLD | NEW |