| 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 // TODO(jhawkins): Use hidden instead of showInline* and display:none. | 5 // TODO(jhawkins): Use hidden instead of showInline* and display:none. |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The type of the download object. The definition is based on | 8 * The type of the download object. The definition is based on |
| 9 * chrome/browser/ui/webui/downloads_dom_handler.cc:CreateDownloadItemValue() | 9 * chrome/browser/ui/webui/downloads_dom_handler.cc:CreateDownloadItemValue() |
| 10 * @typedef {{by_ext_id: (string|undefined), | 10 * @typedef {{by_ext_id: (string|undefined), |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 Downloads.prototype.updateResults = function() { | 168 Downloads.prototype.updateResults = function() { |
| 169 var noDownloadsOrResults = $('no-downloads-or-results'); | 169 var noDownloadsOrResults = $('no-downloads-or-results'); |
| 170 noDownloadsOrResults.textContent = loadTimeData.getString( | 170 noDownloadsOrResults.textContent = loadTimeData.getString( |
| 171 this.searchText_ ? 'no_search_results' : 'no_downloads'); | 171 this.searchText_ ? 'no_search_results' : 'no_downloads'); |
| 172 | 172 |
| 173 var hasDownloads = this.size() > 0; | 173 var hasDownloads = this.size() > 0; |
| 174 this.node_.hidden = !hasDownloads; | 174 this.node_.hidden = !hasDownloads; |
| 175 noDownloadsOrResults.hidden = hasDownloads; | 175 noDownloadsOrResults.hidden = hasDownloads; |
| 176 | 176 |
| 177 if (loadTimeData.getBoolean('allow_deleting_history')) | 177 if (loadTimeData.getBoolean('allow_deleting_history')) |
| 178 $('clear-all').hidden = !hasDownloads || this.searchText_; | 178 $('clear-all').hidden = !hasDownloads || this.searchText_.length > 0; |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 /** | 181 /** |
| 182 * Returns the number of downloads in the model. Used by tests. | 182 * Returns the number of downloads in the model. Used by tests. |
| 183 * @return {number} Returns the number of downloads shown on the page. | 183 * @return {number} Returns the number of downloads shown on the page. |
| 184 */ | 184 */ |
| 185 Downloads.prototype.size = function() { | 185 Downloads.prototype.size = function() { |
| 186 return Object.keys(this.downloads_).length; | 186 return Object.keys(this.downloads_).length; |
| 187 }; | 187 }; |
| 188 | 188 |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 if (Date.now() - start > 50) { | 978 if (Date.now() - start > 50) { |
| 979 clearTimeout(resultsTimeout); | 979 clearTimeout(resultsTimeout); |
| 980 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); | 980 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); |
| 981 break; | 981 break; |
| 982 } | 982 } |
| 983 } | 983 } |
| 984 } | 984 } |
| 985 | 985 |
| 986 // Add handlers to HTML elements. | 986 // Add handlers to HTML elements. |
| 987 window.addEventListener('DOMContentLoaded', load); | 987 window.addEventListener('DOMContentLoaded', load); |
| OLD | NEW |