Chromium Code Reviews| 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 * Sets the display style of a node. | 8 * Sets the display style of a node. |
| 9 * @param {!Element} node The target element to show or hide. | 9 * @param {!Element} node The target element to show or hide. |
| 10 * @param {boolean} isShow Should the target element be visible. | 10 * @param {boolean} isShow Should the target element be visible. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 // We get downloads in display order, so we don't have to worry about | 97 // We get downloads in display order, so we don't have to worry about |
| 98 // maintaining correct order - we can assume that any downloads not in | 98 // maintaining correct order - we can assume that any downloads not in |
| 99 // display order are new ones and so we can add them to the top of the | 99 // display order are new ones and so we can add them to the top of the |
| 100 // list. | 100 // list. |
| 101 if (download.started > this.newestTime_) { | 101 if (download.started > this.newestTime_) { |
| 102 this.node_.insertBefore(this.downloads_[id].node, this.node_.firstChild); | 102 this.node_.insertBefore(this.downloads_[id].node, this.node_.firstChild); |
| 103 this.newestTime_ = download.started; | 103 this.newestTime_ = download.started; |
| 104 } else { | 104 } else { |
| 105 this.node_.appendChild(this.downloads_[id].node); | 105 this.node_.appendChild(this.downloads_[id].node); |
| 106 } | 106 } |
| 107 this.updateDateDisplay_(); | |
| 108 } | 107 } |
| 108 // Download.prototype.update may change its nodeSince_ and nodeDate_, so | |
|
asanka
2012/09/17 16:48:14
Is nodeSince_ updated for all the download items a
benjhayden
2012/09/17 17:02:38
Yes, downloads_dom_handler.cc since_string uses Ti
asanka
2012/09/17 17:50:14
Yeah. I wasn't sure what the intended fix was. It
benjhayden
2012/09/17 18:09:42
I like car analogies, even though I know next to n
| |
| 109 // update all the date displays. | |
| 110 // TODO(benjhayden) Only do this if its nodeSince_ or nodeDate_ actually did | |
| 111 // change since this may touch 150 elements and Downloads.prototype.updated | |
| 112 // may be called 150 times. | |
| 113 this.updateDateDisplay_(); | |
| 109 }; | 114 }; |
| 110 | 115 |
| 111 /** | 116 /** |
| 112 * Set our display search text. | 117 * Set our display search text. |
| 113 * @param {string} searchText The string we're searching for. | 118 * @param {string} searchText The string we're searching for. |
| 114 */ | 119 */ |
| 115 Downloads.prototype.setSearchText = function(searchText) { | 120 Downloads.prototype.setSearchText = function(searchText) { |
| 116 this.searchText_ = searchText; | 121 this.searchText_ = searchText; |
| 117 }; | 122 }; |
| 118 | 123 |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 if (Date.now() - start > 50) { | 750 if (Date.now() - start > 50) { |
| 746 clearTimeout(resultsTimeout); | 751 clearTimeout(resultsTimeout); |
| 747 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); | 752 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); |
| 748 break; | 753 break; |
| 749 } | 754 } |
| 750 } | 755 } |
| 751 } | 756 } |
| 752 | 757 |
| 753 // Add handlers to HTML elements. | 758 // Add handlers to HTML elements. |
| 754 window.addEventListener('DOMContentLoaded', load); | 759 window.addEventListener('DOMContentLoaded', load); |
| OLD | NEW |