Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: chrome/browser/resources/md_bookmarks/reducers.js

Issue 2745993002: MD Bookmarks: Update URL router to work in new data binding system (Closed)
Patch Set: calamity@ review Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 /** 233 /**
234 * @param {?string} selectedFolder 234 * @param {?string} selectedFolder
235 * @param {Action} action 235 * @param {Action} action
236 * @param {NodeList} nodes 236 * @param {NodeList} nodes
237 * @return {?string} 237 * @return {?string}
238 */ 238 */
239 SelectedFolderState.updateSelectedFolder = function( 239 SelectedFolderState.updateSelectedFolder = function(
240 selectedFolder, action, nodes) { 240 selectedFolder, action, nodes) {
241 // TODO(tsergeant): It should not be possible to select a non-folder. 241 // TODO(tsergeant): It should not be possible to select a non-folder.
242 // TODO(tsergeant): Select parent folder when selected folder is deleted.
242 switch (action.name) { 243 switch (action.name) {
243 case 'select-folder': 244 case 'select-folder':
244 return action.id; 245 return action.id;
245 case 'change-folder-open': 246 case 'change-folder-open':
246 // When hiding the selected folder by closing its ancestor, select 247 // When hiding the selected folder by closing its ancestor, select
247 // that ancestor instead. 248 // that ancestor instead.
248 if (!action.open && selectedFolder && 249 if (!action.open && selectedFolder &&
249 SelectedFolderState.isAncestorOf( 250 SelectedFolderState.isAncestorOf(
250 nodes, action.id, selectedFolder)) { 251 nodes, action.id, selectedFolder)) {
251 return action.id; 252 return action.id;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 344
344 return { 345 return {
345 reduceAction: reduceAction, 346 reduceAction: reduceAction,
346 ClosedFolderState: ClosedFolderState, 347 ClosedFolderState: ClosedFolderState,
347 NodeState: NodeState, 348 NodeState: NodeState,
348 SearchState: SearchState, 349 SearchState: SearchState,
349 SelectedFolderState: SelectedFolderState, 350 SelectedFolderState: SelectedFolderState,
350 SelectionState: SelectionState, 351 SelectionState: SelectionState,
351 }; 352 };
352 }); 353 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/compiled_resources2.gyp ('k') | chrome/browser/resources/md_bookmarks/router.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698