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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 function setSearchResults(ids) { | 178 function setSearchResults(ids) { |
165 return { | 179 return { |
166 name: 'finish-search', | 180 name: 'finish-search', |
167 results: ids, | 181 results: ids, |
168 }; | 182 }; |
169 } | 183 } |
170 | 184 |
171 return { | 185 return { |
172 changeFolderOpen: changeFolderOpen, | 186 changeFolderOpen: changeFolderOpen, |
173 clearSearch: clearSearch, | 187 clearSearch: clearSearch, |
| 188 createBookmark: createBookmark, |
174 deselectItems: deselectItems, | 189 deselectItems: deselectItems, |
175 editBookmark: editBookmark, | 190 editBookmark: editBookmark, |
176 moveBookmark: moveBookmark, | 191 moveBookmark: moveBookmark, |
177 refreshNodes: refreshNodes, | 192 refreshNodes: refreshNodes, |
178 removeBookmark: removeBookmark, | 193 removeBookmark: removeBookmark, |
179 selectFolder: selectFolder, | 194 selectFolder: selectFolder, |
180 selectItem: selectItem, | 195 selectItem: selectItem, |
181 setSearchResults: setSearchResults, | 196 setSearchResults: setSearchResults, |
182 setSearchTerm: setSearchTerm, | 197 setSearchTerm: setSearchTerm, |
183 }; | 198 }; |
184 }); | 199 }); |
OLD | NEW |