OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // require: cr.js | 5 // require: cr.js |
6 | 6 |
7 cr.define('chrome.sync', function() { | 7 cr.define('chrome.sync', function() { |
8 var currSearchId = 0; | 8 var currSearchId = 0; |
9 | 9 |
10 /** | 10 /** |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 resultsDataModel.splice(0, resultsDataModel.length); | 56 resultsDataModel.splice(0, resultsDataModel.length); |
57 if (!query) { | 57 if (!query) { |
58 return; | 58 return; |
59 } | 59 } |
60 statusControl.textContent = 'Searching for ' + query + '...'; | 60 statusControl.textContent = 'Searching for ' + query + '...'; |
61 queryControl.removeAttribute('error'); | 61 queryControl.removeAttribute('error'); |
62 var timer = chrome.sync.makeTimer(); | 62 var timer = chrome.sync.makeTimer(); |
63 doSearch(query, function(nodes, error) { | 63 doSearch(query, function(nodes, error) { |
64 if (error) { | 64 if (error) { |
65 statusControl.textContent = 'Error: ' + error; | 65 statusControl.textContent = 'Error: ' + error; |
66 queryControl.setAttribute('error'); | 66 queryControl.setAttribute('error', ''); |
67 } else { | 67 } else { |
68 statusControl.textContent = | 68 statusControl.textContent = |
69 'Found ' + nodes.length + ' nodes in ' + | 69 'Found ' + nodes.length + ' nodes in ' + |
70 timer.elapsedSeconds + 's'; | 70 timer.elapsedSeconds + 's'; |
71 queryControl.removeAttribute('error'); | 71 queryControl.removeAttribute('error'); |
72 | 72 |
73 // TODO(akalin): Write a nicer list display. | 73 // TODO(akalin): Write a nicer list display. |
74 for (var i = 0; i < nodes.length; ++i) { | 74 for (var i = 0; i < nodes.length; ++i) { |
75 nodes[i].toString = function() { | 75 nodes[i].toString = function() { |
76 return this.NON_UNIQUE_NAME; | 76 return this.NON_UNIQUE_NAME; |
(...skipping 16 matching lines...) Expand all Loading... |
93 if (selected) { | 93 if (selected) { |
94 detailsControl.textContent = JSON.stringify(selected, null, 2); | 94 detailsControl.textContent = JSON.stringify(selected, null, 2); |
95 } | 95 } |
96 }); | 96 }); |
97 } | 97 } |
98 | 98 |
99 return { | 99 return { |
100 decorateSearchControls: decorateSearchControls | 100 decorateSearchControls: decorateSearchControls |
101 }; | 101 }; |
102 }); | 102 }); |
OLD | NEW |