Chromium Code Reviews| Index: chrome/browser/resources/md_bookmarks/actions.js |
| diff --git a/chrome/browser/resources/md_bookmarks/actions.js b/chrome/browser/resources/md_bookmarks/actions.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6793084b62af2799a15cbaf0fdb2e89ea765298a |
| --- /dev/null |
| +++ b/chrome/browser/resources/md_bookmarks/actions.js |
| @@ -0,0 +1,81 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview Module for functions which produce action objects. These are |
| + * listed in one place to document available actions and their parameters. |
| + */ |
| + |
| +cr.define('bookmarks.actions', function() { |
| + /** |
| + * @param {string} id |
| + * @param {{title: string, url: (string|undefined)}} changeInfo |
| + * @return {!Action} |
| + */ |
| + function editBookmark(id, changeInfo) { |
| + return { |
| + name: 'edit-bookmark', |
| + id: id, |
| + changeInfo: changeInfo, |
| + }; |
| + } |
| + |
| + /** |
| + * @param {string} id |
| + * @param {string} parentId |
| + * @param {number} index |
| + * @return {!Action} |
| + */ |
| + function removeBookmark(id, parentId, index) { |
| + return { |
| + name: 'remove-bookmark', |
| + id: id, |
| + parentId: parentId, |
| + index: index, |
| + }; |
| + } |
| + |
| + /** |
| + * @param {NodeList} nodeMap |
| + * @return {!Action} |
| + */ |
| + function refreshNodes(nodeMap) { |
| + return { |
| + name: 'refresh-nodes', |
| + nodes: nodeMap, |
| + }; |
| + }; |
| + |
| + /** |
| + * @param {string} id |
| + * @return {!Action} |
| + */ |
| + function selectFolder(id) { |
| + return { |
| + name: 'select-folder', |
| + id: id, |
| + }; |
| + } |
| + |
| + /** |
| + * @param {string} id |
| + * @param {boolean} open |
| + * @return {!Action} |
| + */ |
| + function changeFolderOpen(id, open) { |
| + return { |
| + name: 'change-folder-open', |
| + id: id, |
| + open: open, |
| + }; |
| + } |
| + |
| + return { |
| + editBookmark: editBookmark, |
| + removeBookmark: removeBookmark, |
| + refreshNodes: refreshNodes, |
| + selectFolder: selectFolder, |
| + 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.
|
| + }; |
| +}); |