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

Unified Diff: chrome/browser/resources/md_bookmarks/util.js

Issue 2746363013: [MD Bookmarks] Add a drag and drop indicator to bookmarks. (Closed)
Patch Set: fix nit 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_bookmarks/util.js
diff --git a/chrome/browser/resources/md_bookmarks/util.js b/chrome/browser/resources/md_bookmarks/util.js
index bf20a151c1246529fcb4ca5c327e84df876066ce..c062786787ae08dc97953678fbf2188dc892f9bf 100644
--- a/chrome/browser/resources/md_bookmarks/util.js
+++ b/chrome/browser/resources/md_bookmarks/util.js
@@ -12,8 +12,8 @@ cr.define('bookmarks.util', function() {
* @return {!Array<string>}
*/
function getDisplayedList(state) {
- if (state.selectedFolder)
- return assert(state.nodes[state.selectedFolder].children);
+ if (!isShowingSearch(state))
+ return assert(state.nodes[assert(state.selectedFolder)].children);
return state.search.results;
}
@@ -67,9 +67,34 @@ cr.define('bookmarks.util', function() {
};
}
+ /**
+ * @param {BookmarksPageState} state
+ * @return boolean
+ */
+ function isShowingSearch(state) {
+ return !state.selectedFolder;
+ }
+
+ /**
+ * @param {string} id
+ * @param {NodeList} nodes
+ * @return {boolean}
+ */
+ function hasChildFolders(id, nodes) {
+ var children = nodes[id].children;
+ for (var i = 0; i < children.length; i++) {
+ if (nodes[children[i]].children)
+ return true;
+ }
+ return false;
+ }
+
return {
createEmptyState: createEmptyState,
getDisplayedList: getDisplayedList,
+ hasChildFolders: hasChildFolders,
+ isShowingSearch: isShowingSearch,
normalizeNodes: normalizeNodes,
+ ROOT_NODE_ID: '0',
};
});
« no previous file with comments | « chrome/browser/resources/md_bookmarks/types.js ('k') | chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698