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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 } | 495 } |
496 | 496 |
497 if (this.controlShow_) { | 497 if (this.controlShow_) { |
498 showInline(this.controlShow_, | 498 showInline(this.controlShow_, |
499 this.state_ == Download.States.COMPLETE && | 499 this.state_ == Download.States.COMPLETE && |
500 !this.fileExternallyRemoved_); | 500 !this.fileExternallyRemoved_); |
501 } | 501 } |
502 showInline(this.controlRetry_, this.state_ == Download.States.CANCELLED); | 502 showInline(this.controlRetry_, this.state_ == Download.States.CANCELLED); |
503 this.controlRetry_.href = this.url_; | 503 this.controlRetry_.href = this.url_; |
504 showInline(this.controlPause_, this.state_ == Download.States.IN_PROGRESS); | 504 showInline(this.controlPause_, this.state_ == Download.States.IN_PROGRESS); |
505 showInline(this.controlResume_, this.state_ == Download.States.PAUSED); | 505 showInline(this.controlResume_, |
| 506 this.state_ == Download.States.PAUSED || |
| 507 this.state_ == Download.States.INTERRUPTED); |
506 var showCancel = this.state_ == Download.States.IN_PROGRESS || | 508 var showCancel = this.state_ == Download.States.IN_PROGRESS || |
507 this.state_ == Download.States.PAUSED; | 509 this.state_ == Download.States.PAUSED || |
| 510 this.state_ == Download.States.INTERRUPTED; |
508 showInline(this.controlCancel_, showCancel); | 511 showInline(this.controlCancel_, showCancel); |
509 showInline(this.controlRemove_, !showCancel); | 512 showInline(this.controlRemove_, !showCancel); |
510 | 513 |
511 this.nodeSince_.textContent = this.since_; | 514 this.nodeSince_.textContent = this.since_; |
512 this.nodeDate_.textContent = this.date_; | 515 this.nodeDate_.textContent = this.date_; |
513 // Don't unnecessarily update the url, as doing so will remove any | 516 // Don't unnecessarily update the url, as doing so will remove any |
514 // text selection the user has started (http://crbug.com/44982). | 517 // text selection the user has started (http://crbug.com/44982). |
515 if (this.nodeURL_.textContent != this.url_) { | 518 if (this.nodeURL_.textContent != this.url_) { |
516 this.nodeURL_.textContent = this.url_; | 519 this.nodeURL_.textContent = this.url_; |
517 this.nodeURL_.href = this.url_; | 520 this.nodeURL_.href = this.url_; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 if (Date.now() - start > 50) { | 753 if (Date.now() - start > 50) { |
751 clearTimeout(resultsTimeout); | 754 clearTimeout(resultsTimeout); |
752 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); | 755 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); |
753 break; | 756 break; |
754 } | 757 } |
755 } | 758 } |
756 } | 759 } |
757 | 760 |
758 // Add handlers to HTML elements. | 761 // Add handlers to HTML elements. |
759 window.addEventListener('DOMContentLoaded', load); | 762 window.addEventListener('DOMContentLoaded', load); |
OLD | NEW |