| 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) {
|
|
|