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

Unified Diff: chrome/browser/resources/sync_internals/sync_node_browser.js

Issue 1226213002: Sync: Support nodes with implicit permanent folders: Node Browser and out-of-order loading from DB (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed comments Created 5 years, 5 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/sync_internals/sync_node_browser.js
diff --git a/chrome/browser/resources/sync_internals/sync_node_browser.js b/chrome/browser/resources/sync_internals/sync_node_browser.js
index 369916457a58562f77250e86c7055e9e0174be87..c468016ad331126be332d51f963a6da8c94db242 100644
--- a/chrome/browser/resources/sync_internals/sync_node_browser.js
+++ b/chrome/browser/resources/sync_internals/sync_node_browser.js
@@ -12,19 +12,24 @@
*
* @param {!Object} node The node to check.
*/
- var isTypeRootNode = function(node) {
- return node.PARENT_ID == 'r' && node.UNIQUE_SERVER_TAG != '';
- }
+ var isTypeRootNode = function(node) {
+ return node.PARENT_ID == 'r' && node.UNIQUE_SERVER_TAG != '';
+ };
/**
* A helper function to determine if a node is a child of the given parent.
*
- * @param {string} parentId The ID of the parent.
+ * @param {!Object} parent node.
* @param {!Object} node The node to check.
*/
- var isChildOf = function(parentId, node) {
- return node.PARENT_ID == parentId;
- }
+ var isChildOf = function(parentNode, node) {
+ if (node.PARENT_ID != '') {
+ return node.PARENT_ID == parentNode.ID;
+ }
+ else {
+ return node.modelType == parentNode.modelType;
+ }
+ };
/**
* A helper function to sort sync nodes.
@@ -35,16 +40,16 @@
* If this proves to be slow and expensive, we should experiment with moving
* this functionality to C++ instead.
*/
- var nodeComparator = function(nodeA, nodeB) {
+ var nodeComparator = function(nodeA, nodeB) {
if (nodeA.hasOwnProperty('positionIndex') &&
- nodeB.hasOwnProperty('positionIndex')) {
- return nodeA.positionIndex - nodeB.positionIndex;
- } else if (nodeA.NON_UNIQUE_NAME != nodeB.NON_UNIQUE_NAME) {
- return nodeA.NON_UNIQUE_NAME.localeCompare(nodeB.NON_UNIQUE_NAME);
- } else {
- return nodeA.METAHANDLE - nodeB.METAHANDLE;
- }
- }
+ nodeB.hasOwnProperty('positionIndex')) {
+ return nodeA.positionIndex - nodeB.positionIndex;
+ } else if (nodeA.NON_UNIQUE_NAME != nodeB.NON_UNIQUE_NAME) {
+ return nodeA.NON_UNIQUE_NAME.localeCompare(nodeB.NON_UNIQUE_NAME);
+ } else {
+ return nodeA.METAHANDLE - nodeB.METAHANDLE;
+ }
+ };
/**
* Updates the node detail view with the details for the given node.
@@ -106,7 +111,7 @@
treeItem.expanded_ = true;
var children = treeItem.tree.allNodes.filter(
- isChildOf.bind(undefined, treeItem.entry_.ID));
+ isChildOf.bind(undefined, treeItem.entry_));
children.sort(nodeComparator);
children.forEach(function(node) {
« no previous file with comments | « chrome/browser/resources/sync_internals/node_browser.html ('k') | chrome/browser/ui/webui/sync_internals_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698