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 of functions which produce a new page state in response | 6 * @fileoverview Module of functions which produce a new page state in response |
7 * to an action. Reducers (in the same sense as Array.prototype.reduce) must be | 7 * to an action. Reducers (in the same sense as Array.prototype.reduce) must be |
8 * pure functions: they must not modify existing state objects, or make any API | 8 * pure functions: they must not modify existing state objects, or make any API |
9 * calls. | 9 * calls. |
10 */ | 10 */ |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 /** | 46 /** |
47 * @param {SelectionState} selection | 47 * @param {SelectionState} selection |
48 * @param {Action} action | 48 * @param {Action} action |
49 * @return {SelectionState} | 49 * @return {SelectionState} |
50 */ | 50 */ |
51 SelectionState.updateSelection = function(selection, action) { | 51 SelectionState.updateSelection = function(selection, action) { |
52 switch (action.name) { | 52 switch (action.name) { |
53 case 'clear-search': | 53 case 'clear-search': |
54 case 'finish-search': | 54 case 'finish-search': |
55 case 'select-folder': | 55 case 'select-folder': |
| 56 case 'deselect-items': |
56 return SelectionState.deselectAll(selection); | 57 return SelectionState.deselectAll(selection); |
57 case 'select-items': | 58 case 'select-items': |
58 return SelectionState.selectItems(selection, action); | 59 return SelectionState.selectItems(selection, action); |
59 } | 60 } |
60 return selection; | 61 return selection; |
61 }; | 62 }; |
62 | 63 |
63 var SearchState = {}; | 64 var SearchState = {}; |
64 | 65 |
65 /** | 66 /** |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 345 |
345 return { | 346 return { |
346 reduceAction: reduceAction, | 347 reduceAction: reduceAction, |
347 ClosedFolderState: ClosedFolderState, | 348 ClosedFolderState: ClosedFolderState, |
348 NodeState: NodeState, | 349 NodeState: NodeState, |
349 SearchState: SearchState, | 350 SearchState: SearchState, |
350 SelectedFolderState: SelectedFolderState, | 351 SelectedFolderState: SelectedFolderState, |
351 SelectionState: SelectionState, | 352 SelectionState: SelectionState, |
352 }; | 353 }; |
353 }); | 354 }); |
OLD | NEW |