| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 * @param {PreferencesState} prefs | 401 * @param {PreferencesState} prefs |
| 402 * @param {Action} action | 402 * @param {Action} action |
| 403 * @return {PreferencesState} | 403 * @return {PreferencesState} |
| 404 */ | 404 */ |
| 405 PreferencesState.updatePrefs = function(prefs, action) { | 405 PreferencesState.updatePrefs = function(prefs, action) { |
| 406 switch (action.name) { | 406 switch (action.name) { |
| 407 case 'set-incognito-availability': | 407 case 'set-incognito-availability': |
| 408 return /** @type {PreferencesState} */ (Object.assign({}, prefs, { | 408 return /** @type {PreferencesState} */ (Object.assign({}, prefs, { |
| 409 incognitoAvailability: action.value, | 409 incognitoAvailability: action.value, |
| 410 })); | 410 })); |
| 411 case 'set-can-edit': |
| 412 return /** @type {PreferencesState} */ (Object.assign({}, prefs, { |
| 413 canEdit: action.value, |
| 414 })); |
| 411 default: | 415 default: |
| 412 return prefs; | 416 return prefs; |
| 413 } | 417 } |
| 414 }; | 418 }; |
| 415 | 419 |
| 416 /** | 420 /** |
| 417 * @param {ClosedFolderState} closedFolders | 421 * @param {ClosedFolderState} closedFolders |
| 418 * @param {Action} action | 422 * @param {Action} action |
| 419 * @param {NodeMap} nodes | 423 * @param {NodeMap} nodes |
| 420 * @return {ClosedFolderState} | 424 * @return {ClosedFolderState} |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 return { | 468 return { |
| 465 reduceAction: reduceAction, | 469 reduceAction: reduceAction, |
| 466 ClosedFolderState: ClosedFolderState, | 470 ClosedFolderState: ClosedFolderState, |
| 467 NodeState: NodeState, | 471 NodeState: NodeState, |
| 468 PreferencesState: PreferencesState, | 472 PreferencesState: PreferencesState, |
| 469 SearchState: SearchState, | 473 SearchState: SearchState, |
| 470 SelectedFolderState: SelectedFolderState, | 474 SelectedFolderState: SelectedFolderState, |
| 471 SelectionState: SelectionState, | 475 SelectionState: SelectionState, |
| 472 }; | 476 }; |
| 473 }); | 477 }); |
| OLD | NEW |