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

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

Issue 2813503002: MD Bookmarks: Prevent navigating to invalid folders (Closed)
Patch Set: Rebase & Implement deferred actions Created 3 years, 7 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 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 */ 90 */
91 function refreshNodes(nodeMap) { 91 function refreshNodes(nodeMap) {
92 return { 92 return {
93 name: 'refresh-nodes', 93 name: 'refresh-nodes',
94 nodes: nodeMap, 94 nodes: nodeMap,
95 }; 95 };
96 }; 96 };
97 97
98 /** 98 /**
99 * @param {string} id 99 * @param {string} id
100 * @return {!Action} 100 * @param {NodeMap} nodes Current node state. Can be ommitted in tests.
101 * @return {?Action}
101 */ 102 */
102 function selectFolder(id) { 103 function selectFolder(id, nodes) {
103 assert(id != '0', 'Cannot select root folder'); 104 if (nodes && (id == ROOT_NODE_ID || !nodes[id] || nodes[id].url))
calamity 2017/05/02 08:27:15 Hmm. Do you think it's reasonable to leave a conso
tsergeant 2017/05/03 02:57:31 I've added the warning. There are some legitimate
calamity 2017/05/03 07:49:46 Could you provide some examples?
tsergeant 2017/05/04 01:08:49 The main one is if you delete a folder that you ha
105 return null;
106
104 return { 107 return {
105 name: 'select-folder', 108 name: 'select-folder',
106 id: id, 109 id: id,
107 }; 110 };
108 } 111 }
109 112
110 /** 113 /**
111 * @param {string} id 114 * @param {string} id
112 * @param {boolean} open 115 * @param {boolean} open
113 * @return {!Action} 116 * @return {!Action}
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 moveBookmark: moveBookmark, 209 moveBookmark: moveBookmark,
207 refreshNodes: refreshNodes, 210 refreshNodes: refreshNodes,
208 removeBookmark: removeBookmark, 211 removeBookmark: removeBookmark,
209 reorderChildren: reorderChildren, 212 reorderChildren: reorderChildren,
210 selectFolder: selectFolder, 213 selectFolder: selectFolder,
211 selectItem: selectItem, 214 selectItem: selectItem,
212 setSearchResults: setSearchResults, 215 setSearchResults: setSearchResults,
213 setSearchTerm: setSearchTerm, 216 setSearchTerm: setSearchTerm,
214 }; 217 };
215 }); 218 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/folder_node.js » ('j') | chrome/browser/resources/md_bookmarks/router.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698