Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html i18n-values="dir:textdirection;"> | 2 <html i18n-values="dir:textdirection;"> |
| 3 <head> | 3 <head> |
| 4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
| 5 <title i18n-content="title"></title> | 5 <title i18n-content="title"></title> |
| 6 <link rel="icon" href="../../app/theme/downloads_favicon.png"> | 6 <link rel="icon" href="../../app/theme/downloads_favicon.png"> |
| 7 <style> | 7 <style> |
| 8 body { | 8 body { |
| 9 background-color: white; | 9 background-color: white; |
| 10 color: black; | 10 color: black; |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 } | 456 } |
| 457 | 457 |
| 458 /** | 458 /** |
| 459 * The states a download can be in. These correspond to states defined in | 459 * The states a download can be in. These correspond to states defined in |
| 460 * DownloadsDOMHandler::CreateDownloadItemValue | 460 * DownloadsDOMHandler::CreateDownloadItemValue |
| 461 */ | 461 */ |
| 462 Download.States = { | 462 Download.States = { |
| 463 IN_PROGRESS : "IN_PROGRESS", | 463 IN_PROGRESS : "IN_PROGRESS", |
| 464 CANCELLED : "CANCELLED", | 464 CANCELLED : "CANCELLED", |
| 465 COMPLETE : "COMPLETE", | 465 COMPLETE : "COMPLETE", |
| 466 REMOVED : "REMOVED", | |
| 466 PAUSED : "PAUSED", | 467 PAUSED : "PAUSED", |
| 467 DANGEROUS : "DANGEROUS", | 468 DANGEROUS : "DANGEROUS", |
| 468 INTERRUPTED : "INTERRUPTED", | 469 INTERRUPTED : "INTERRUPTED", |
| 469 } | 470 } |
| 470 | 471 |
| 471 /** | 472 /** |
| 472 * Explains why a download is in DANGEROUS state. | 473 * Explains why a download is in DANGEROUS state. |
| 473 */ | 474 */ |
| 474 Download.DangerType = { | 475 Download.DangerType = { |
| 475 NOT_DANGEROUS: "NOT_DANGEROUS", | 476 NOT_DANGEROUS: "NOT_DANGEROUS", |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 492 | 493 |
| 493 /** | 494 /** |
| 494 * Updates the download to reflect new data. | 495 * Updates the download to reflect new data. |
| 495 * @param {Object} download A backend download object (see downloads_ui.cc) | 496 * @param {Object} download A backend download object (see downloads_ui.cc) |
| 496 */ | 497 */ |
| 497 Download.prototype.update = function(download) { | 498 Download.prototype.update = function(download) { |
| 498 this.id_ = download.id; | 499 this.id_ = download.id; |
| 499 this.filePath_ = download.file_path; | 500 this.filePath_ = download.file_path; |
| 500 this.fileName_ = download.file_name; | 501 this.fileName_ = download.file_name; |
| 501 this.url_ = download.url; | 502 this.url_ = download.url; |
| 502 this.state_ = download.state; | 503 // This code is tricky and is not so good. See issue 6905049 for more details. |
|
Paweł Hajdan Jr.
2011/05/13 08:41:10
No no, I think we have enough hacks in the downloa
haraken1
2011/05/13 14:08:17
I would like to postpone to fix this hack. As Rand
Randy Smith (Not in Mondays)
2011/05/13 20:45:32
haraken: I'm afraid I want to support Pawel on thi
| |
| 504 if (this.state_ != Download.States.REMOVED) { | |
| 505 this.state_ = download.state; | |
| 506 } | |
| 503 this.dangerType_ = download.danger_type; | 507 this.dangerType_ = download.danger_type; |
| 504 | 508 |
| 505 this.since_ = download.since_string; | 509 this.since_ = download.since_string; |
| 506 this.date_ = download.date_string; | 510 this.date_ = download.date_string; |
| 507 | 511 |
| 508 // See DownloadItem::PercentComplete | 512 // See DownloadItem::PercentComplete |
| 509 this.percent_ = Math.max(download.percent, 0); | 513 this.percent_ = Math.max(download.percent, 0); |
| 510 this.progressStatusText_ = download.progress_status_text; | 514 this.progressStatusText_ = download.progress_status_text; |
| 511 this.received_ = download.received; | 515 this.received_ = download.received; |
| 512 | 516 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 610 | 614 |
| 611 /** | 615 /** |
| 612 * @return {String} User-visible status update text. | 616 * @return {String} User-visible status update text. |
| 613 */ | 617 */ |
| 614 Download.prototype.getStatusText_ = function() { | 618 Download.prototype.getStatusText_ = function() { |
| 615 switch (this.state_) { | 619 switch (this.state_) { |
| 616 case Download.States.IN_PROGRESS: | 620 case Download.States.IN_PROGRESS: |
| 617 return this.progressStatusText_; | 621 return this.progressStatusText_; |
| 618 case Download.States.CANCELLED: | 622 case Download.States.CANCELLED: |
| 619 return localStrings.getString('status_cancelled'); | 623 return localStrings.getString('status_cancelled'); |
| 624 case Download.States.REMOVED: | |
| 625 return localStrings.getString('status_removed'); | |
| 620 case Download.States.PAUSED: | 626 case Download.States.PAUSED: |
| 621 return localStrings.getString('status_paused'); | 627 return localStrings.getString('status_paused'); |
| 622 case Download.States.DANGEROUS: | 628 case Download.States.DANGEROUS: |
| 623 var desc = this.dangerType_ == Download.DangerType.DANGEROUS_FILE ? | 629 var desc = this.dangerType_ == Download.DangerType.DANGEROUS_FILE ? |
| 624 'danger_file_desc' : 'danger_url_desc'; | 630 'danger_file_desc' : 'danger_url_desc'; |
| 625 return localStrings.getString(desc); | 631 return localStrings.getString(desc); |
| 626 case Download.States.INTERRUPTED: | 632 case Download.States.INTERRUPTED: |
| 627 return localStrings.getString('status_interrupted'); | 633 return localStrings.getString('status_interrupted'); |
| 628 case Download.States.COMPLETE: | 634 case Download.States.COMPLETE: |
| 629 return ''; | 635 return ''; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 774 <div id="downloads-summary"> | 780 <div id="downloads-summary"> |
| 775 <span id="downloads-summary-text" i18n-content="downloads">Downloads</span> | 781 <span id="downloads-summary-text" i18n-content="downloads">Downloads</span> |
| 776 <a id="clear-all" href="" onclick="clearAll();" i18n-content="clear_all">Cle ar All</a> | 782 <a id="clear-all" href="" onclick="clearAll();" i18n-content="clear_all">Cle ar All</a> |
| 777 </div> | 783 </div> |
| 778 <div id="downloads-display"></div> | 784 <div id="downloads-display"></div> |
| 779 </div> | 785 </div> |
| 780 <div class="footer"> | 786 <div class="footer"> |
| 781 </div> | 787 </div> |
| 782 </body> | 788 </body> |
| 783 </html> | 789 </html> |
| OLD | NEW |