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

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

Issue 2746363013: [MD Bookmarks] Add a drag and drop indicator to bookmarks. (Closed)
Patch Set: address comments, add test 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 SelectedFolderState.isAncestorOf( 249 SelectedFolderState.isAncestorOf(
250 nodes, action.id, selectedFolder)) { 250 nodes, action.id, selectedFolder)) {
251 return action.id; 251 return action.id;
252 } 252 }
253 return selectedFolder; 253 return selectedFolder;
254 case 'finish-search': 254 case 'finish-search':
255 return null; 255 return null;
256 case 'clear-search': 256 case 'clear-search':
257 // TODO(tsergeant): Return to the folder that was selected before the 257 // TODO(tsergeant): Return to the folder that was selected before the
258 // search. 258 // search.
259 return nodes['0'].children[0]; 259 return nodes[bookmarks.util.ROOT_NODE_ID].children[0];
260 default: 260 default:
261 return selectedFolder; 261 return selectedFolder;
262 } 262 }
263 }; 263 };
264 264
265 var ClosedFolderState = {}; 265 var ClosedFolderState = {};
266 266
267 /** 267 /**
268 * @param {ClosedFolderState} closedFolders 268 * @param {ClosedFolderState} closedFolders
269 * @param {string|undefined} id 269 * @param {string|undefined} id
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 return { 344 return {
345 reduceAction: reduceAction, 345 reduceAction: reduceAction,
346 ClosedFolderState: ClosedFolderState, 346 ClosedFolderState: ClosedFolderState,
347 NodeState: NodeState, 347 NodeState: NodeState,
348 SearchState: SearchState, 348 SearchState: SearchState,
349 SelectedFolderState: SelectedFolderState, 349 SelectedFolderState: SelectedFolderState,
350 SelectionState: SelectionState, 350 SelectionState: SelectionState,
351 }; 351 };
352 }); 352 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698