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 var setQueryString = function(queryControl, query) { | 10 var setQueryString = function(queryControl, query) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 statusControl.textContent = 'Searching for ' + query + '...'; | 90 statusControl.textContent = 'Searching for ' + query + '...'; |
91 queryControl.removeAttribute('error'); | 91 queryControl.removeAttribute('error'); |
92 var timer = chrome.sync.makeTimer(); | 92 var timer = chrome.sync.makeTimer(); |
93 doSearch(query, function(nodes, error) { | 93 doSearch(query, function(nodes, error) { |
94 if (error) { | 94 if (error) { |
95 statusControl.textContent = 'Error: ' + error; | 95 statusControl.textContent = 'Error: ' + error; |
96 queryControl.setAttribute('error', ''); | 96 queryControl.setAttribute('error', ''); |
97 } else { | 97 } else { |
98 statusControl.textContent = | 98 statusControl.textContent = |
99 'Found ' + nodes.length + ' nodes in ' + | 99 'Found ' + nodes.length + ' nodes in ' + |
100 timer.elapsedSeconds + 's'; | 100 timer.getElapsedSeconds() + 's'; |
101 queryControl.removeAttribute('error'); | 101 queryControl.removeAttribute('error'); |
102 | 102 |
103 // TODO(akalin): Write a nicer list display. | 103 // TODO(akalin): Write a nicer list display. |
104 for (var i = 0; i < nodes.length; ++i) { | 104 for (var i = 0; i < nodes.length; ++i) { |
105 nodes[i].toString = function() { | 105 nodes[i].toString = function() { |
106 return this.NON_UNIQUE_NAME; | 106 return this.NON_UNIQUE_NAME; |
107 }; | 107 }; |
108 } | 108 } |
109 resultsDataModel.push.apply(resultsDataModel, nodes); | 109 resultsDataModel.push.apply(resultsDataModel, nodes); |
110 // Workaround for http://crbug.com/83452 . | 110 // Workaround for http://crbug.com/83452 . |
(...skipping 17 matching lines...) Expand all Loading... |
128 detailsControl.textContent = JSON.stringify(selected, null, 2); | 128 detailsControl.textContent = JSON.stringify(selected, null, 2); |
129 } | 129 } |
130 }); | 130 }); |
131 } | 131 } |
132 | 132 |
133 return { | 133 return { |
134 decorateSearchControls: decorateSearchControls, | 134 decorateSearchControls: decorateSearchControls, |
135 decorateQuickQueryControls: decorateQuickQueryControls | 135 decorateQuickQueryControls: decorateQuickQueryControls |
136 }; | 136 }; |
137 }); | 137 }); |
OLD | NEW |