| 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() { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return { | 184 return { |
| 185 name: 'select-items', | 185 name: 'select-items', |
| 186 clear: config.clear, | 186 clear: config.clear, |
| 187 toggle: config.toggle, | 187 toggle: config.toggle, |
| 188 anchor: newAnchor, | 188 anchor: newAnchor, |
| 189 items: toSelect, | 189 items: toSelect, |
| 190 }; | 190 }; |
| 191 } | 191 } |
| 192 | 192 |
| 193 /** | 193 /** |
| 194 * @param {Array<string>} ids |
| 195 * @param {BookmarksPageState} state |
| 196 * @return {!Action} |
| 197 */ |
| 198 function selectAll(ids, state) { |
| 199 return { |
| 200 name: 'select-items', |
| 201 clear: true, |
| 202 toggle: false, |
| 203 anchor: state.selection.anchor, |
| 204 items: ids, |
| 205 }; |
| 206 } |
| 207 |
| 208 /** |
| 209 * @param {string} id |
| 210 * @return {!Action} |
| 211 */ |
| 212 function updateAnchor(id) { |
| 213 return { |
| 214 name: 'update-anchor', |
| 215 anchor: id, |
| 216 }; |
| 217 } |
| 218 |
| 219 /** |
| 194 * @param {string} term | 220 * @param {string} term |
| 195 * @return {!Action} | 221 * @return {!Action} |
| 196 */ | 222 */ |
| 197 function setSearchTerm(term) { | 223 function setSearchTerm(term) { |
| 198 if (!term) | 224 if (!term) |
| 199 return clearSearch(); | 225 return clearSearch(); |
| 200 | 226 |
| 201 return { | 227 return { |
| 202 name: 'start-search', | 228 name: 'start-search', |
| 203 term: term, | 229 term: term, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 218 return { | 244 return { |
| 219 changeFolderOpen: changeFolderOpen, | 245 changeFolderOpen: changeFolderOpen, |
| 220 clearSearch: clearSearch, | 246 clearSearch: clearSearch, |
| 221 createBookmark: createBookmark, | 247 createBookmark: createBookmark, |
| 222 deselectItems: deselectItems, | 248 deselectItems: deselectItems, |
| 223 editBookmark: editBookmark, | 249 editBookmark: editBookmark, |
| 224 moveBookmark: moveBookmark, | 250 moveBookmark: moveBookmark, |
| 225 refreshNodes: refreshNodes, | 251 refreshNodes: refreshNodes, |
| 226 removeBookmark: removeBookmark, | 252 removeBookmark: removeBookmark, |
| 227 reorderChildren: reorderChildren, | 253 reorderChildren: reorderChildren, |
| 254 selectAll: selectAll, |
| 228 selectFolder: selectFolder, | 255 selectFolder: selectFolder, |
| 229 selectItem: selectItem, | 256 selectItem: selectItem, |
| 230 setSearchResults: setSearchResults, | 257 setSearchResults: setSearchResults, |
| 231 setSearchTerm: setSearchTerm, | 258 setSearchTerm: setSearchTerm, |
| 259 updateAnchor: updateAnchor, |
| 232 }; | 260 }; |
| 233 }); | 261 }); |
| OLD | NEW |