Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview Module for functions which produce action objects. These are | |
| 7 * listed in one place to document available actions and their parameters. | |
| 8 */ | |
| 9 | |
| 10 cr.define('bookmarks.actions', function() { | |
| 11 /** | |
| 12 * @param {string} id | |
| 13 * @param {{title: string, url: (string|undefined)}} changeInfo | |
| 14 * @return {!Action} | |
| 15 */ | |
| 16 function editBookmark(id, changeInfo) { | |
| 17 return { | |
| 18 name: 'edit-bookmark', | |
| 19 id: id, | |
| 20 changeInfo: changeInfo, | |
| 21 }; | |
| 22 } | |
| 23 | |
| 24 /** | |
| 25 * @param {string} id | |
| 26 * @param {string} parentId | |
| 27 * @param {number} index | |
| 28 * @return {!Action} | |
| 29 */ | |
| 30 function removeBookmark(id, parentId, index) { | |
| 31 return { | |
| 32 name: 'remove-bookmark', | |
| 33 id: id, | |
| 34 parentId: parentId, | |
| 35 index: index, | |
| 36 }; | |
| 37 } | |
| 38 | |
| 39 /** | |
| 40 * @param {NodeList} nodeMap | |
| 41 * @return {!Action} | |
| 42 */ | |
| 43 function refreshNodes(nodeMap) { | |
| 44 return { | |
| 45 name: 'refresh-nodes', | |
| 46 nodes: nodeMap, | |
| 47 }; | |
| 48 }; | |
| 49 | |
| 50 /** | |
| 51 * @param {string} id | |
| 52 * @return {!Action} | |
| 53 */ | |
| 54 function selectFolder(id) { | |
| 55 return { | |
| 56 name: 'select-folder', | |
| 57 id: id, | |
| 58 }; | |
| 59 } | |
| 60 | |
| 61 /** | |
| 62 * @param {string} id | |
| 63 * @param {boolean} open | |
| 64 * @return {!Action} | |
| 65 */ | |
| 66 function changeFolderOpen(id, open) { | |
| 67 return { | |
| 68 name: 'change-folder-open', | |
| 69 id: id, | |
| 70 open: open, | |
| 71 }; | |
| 72 } | |
| 73 | |
| 74 return { | |
| 75 editBookmark: editBookmark, | |
| 76 removeBookmark: removeBookmark, | |
| 77 refreshNodes: refreshNodes, | |
| 78 selectFolder: selectFolder, | |
| 79 changeFolderOpen: changeFolderOpen, | |
|
calamity
2017/03/07 07:27:35
nit: Sort? I don't feel super strongly.
tsergeant
2017/03/08 02:47:10
Done.
| |
| 80 }; | |
| 81 }); | |
| OLD | NEW |