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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 } | 504 } |
505 | 505 |
506 if (this.controlShow_) { | 506 if (this.controlShow_) { |
507 showInline(this.controlShow_, | 507 showInline(this.controlShow_, |
508 this.state_ == Download.States.COMPLETE && | 508 this.state_ == Download.States.COMPLETE && |
509 !this.fileExternallyRemoved_); | 509 !this.fileExternallyRemoved_); |
510 } | 510 } |
511 showInline(this.controlRetry_, download.retry); | 511 showInline(this.controlRetry_, download.retry); |
512 this.controlRetry_.href = this.url_; | 512 this.controlRetry_.href = this.url_; |
513 showInline(this.controlPause_, this.state_ == Download.States.IN_PROGRESS); | 513 showInline(this.controlPause_, this.state_ == Download.States.IN_PROGRESS); |
514 showInline(this.controlResume_, this.state_ == Download.States.PAUSED); | 514 showInline(this.controlResume_, download.resume); |
515 var showCancel = this.state_ == Download.States.IN_PROGRESS || | 515 var showCancel = this.state_ == Download.States.IN_PROGRESS || |
516 this.state_ == Download.States.PAUSED; | 516 this.state_ == Download.States.PAUSED; |
517 showInline(this.controlCancel_, showCancel); | 517 showInline(this.controlCancel_, showCancel); |
518 showInline(this.controlRemove_, !showCancel); | 518 showInline(this.controlRemove_, !showCancel); |
519 | 519 |
520 this.nodeSince_.textContent = this.since_; | 520 this.nodeSince_.textContent = this.since_; |
521 this.nodeDate_.textContent = this.date_; | 521 this.nodeDate_.textContent = this.date_; |
522 // Don't unnecessarily update the url, as doing so will remove any | 522 // Don't unnecessarily update the url, as doing so will remove any |
523 // text selection the user has started (http://crbug.com/44982). | 523 // text selection the user has started (http://crbug.com/44982). |
524 if (this.nodeURL_.textContent != this.url_) { | 524 if (this.nodeURL_.textContent != this.url_) { |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 if (Date.now() - start > 50) { | 784 if (Date.now() - start > 50) { |
785 clearTimeout(resultsTimeout); | 785 clearTimeout(resultsTimeout); |
786 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); | 786 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); |
787 break; | 787 break; |
788 } | 788 } |
789 } | 789 } |
790 } | 790 } |
791 | 791 |
792 // Add handlers to HTML elements. | 792 // Add handlers to HTML elements. |
793 window.addEventListener('DOMContentLoaded', load); | 793 window.addEventListener('DOMContentLoaded', load); |
OLD | NEW |