Index: chrome/browser/resources/sync_internals/sync_search.js |
diff --git a/chrome/browser/resources/sync_internals/sync_search.js b/chrome/browser/resources/sync_internals/sync_search.js |
index 95d27223c6375007222af8fc91fcc9816f914119..da8fcafb73315c6b7b54d5e71cf387ac913a829a 100644 |
--- a/chrome/browser/resources/sync_internals/sync_search.js |
+++ b/chrome/browser/resources/sync_internals/sync_search.js |
@@ -10,24 +10,19 @@ cr.define('chrome.sync', function() { |
/** |
* Runs a search with the given query. |
* |
- * @param {string} query The query to do the search with. |
- * @param {Array.<{id: string, title: string, isFolder: boolean}>} |
+ * @param {string} query The regex to do the search with. |
+ * @param {Array.<NodeSummary>} |
* callback The callback called with the search results; not |
* called if doSearch() is called again while the search is |
* running. |
*/ |
var doSearch = function(query, callback) { |
var searchId = ++currSearchId; |
- chrome.sync.findNodesContainingString(query, function(ids) { |
- if (currSearchId != searchId) { |
- return; |
- } |
- chrome.sync.getNodeSummariesById(ids, function(nodeSummaries) { |
- if (currSearchId != searchId) { |
- return; |
- } |
- callback(nodeSummaries); |
- }); |
+ chrome.sync.getAllNodes(query, function(allNodes) { |
+ var regex = new RegExp(query); |
+ callback(allNodes.filter(function (elem) { |
+ return JSON.stringify(elem).match(regex); |
rlarocque
2012/03/27 01:49:05
I believe JSON.stringify returns a "compact" versi
akalin
2012/03/29 18:41:43
Does searching the raw json provide us any benefit
rlarocque
2012/03/29 20:51:32
Searching the serialized version makes it easy to
|
+ })); |
}); |
}; |
@@ -64,7 +59,7 @@ cr.define('chrome.sync', function() { |
// TODO(akalin): Write a nicer list display. |
for (var i = 0; i < nodeSummaries.length; ++i) { |
nodeSummaries[i].toString = function() { |
- return this.title; |
+ return this.NON_UNIQUE_NAME; |
akalin
2012/03/29 18:41:43
any reason you changed this? is the NON_UNIQUE_NA
rlarocque
2012/03/29 20:51:32
Less readable, actually. It's a long story.
Th
rlarocque
2012/03/30 21:52:30
I talked to Nicolas about this. It turns out that
|
}.bind(nodeSummaries[i]); |
} |
resultsDataModel.push.apply(resultsDataModel, nodeSummaries); |
@@ -81,7 +76,8 @@ cr.define('chrome.sync', function() { |
detailsControl.textContent = ''; |
var selected = resultsControl.selectedItem; |
if (selected) { |
- chrome.sync.getNodeDetailsById([selected.id], function(nodeDetails) { |
+ chrome.sync.getNodeDetailsById([selected.META_HANDLE], |
akalin
2012/03/29 18:41:43
hunh. is id == META_HANDLE? any reason you chang
rlarocque
2012/03/29 20:51:32
Same as above, but id == META_HANDLE (as opposed t
|
+ function(nodeDetails) { |
var selectedNodeDetails = nodeDetails[0] || null; |
if (selectedNodeDetails) { |
detailsControl.textContent = |