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 // TODO(haraken): This code is tricky and should be refined. |
504 // See http://crbug.com/82531 | |
Randy Smith (Not in Mondays)
2011/05/13 20:45:32
To add a little more meat to my earlier suggestion
haraken1
2011/05/16 11:42:27
That's a great solution!!! I fixed it using a FIFO
| |
505 if (this.state_ != Download.States.REMOVED) { | |
506 this.state_ = download.state; | |
507 } | |
503 this.dangerType_ = download.danger_type; | 508 this.dangerType_ = download.danger_type; |
504 | 509 |
505 this.since_ = download.since_string; | 510 this.since_ = download.since_string; |
506 this.date_ = download.date_string; | 511 this.date_ = download.date_string; |
507 | 512 |
508 // See DownloadItem::PercentComplete | 513 // See DownloadItem::PercentComplete |
509 this.percent_ = Math.max(download.percent, 0); | 514 this.percent_ = Math.max(download.percent, 0); |
510 this.progressStatusText_ = download.progress_status_text; | 515 this.progressStatusText_ = download.progress_status_text; |
511 this.received_ = download.received; | 516 this.received_ = download.received; |
512 | 517 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
610 | 615 |
611 /** | 616 /** |
612 * @return {String} User-visible status update text. | 617 * @return {String} User-visible status update text. |
613 */ | 618 */ |
614 Download.prototype.getStatusText_ = function() { | 619 Download.prototype.getStatusText_ = function() { |
615 switch (this.state_) { | 620 switch (this.state_) { |
616 case Download.States.IN_PROGRESS: | 621 case Download.States.IN_PROGRESS: |
617 return this.progressStatusText_; | 622 return this.progressStatusText_; |
618 case Download.States.CANCELLED: | 623 case Download.States.CANCELLED: |
619 return localStrings.getString('status_cancelled'); | 624 return localStrings.getString('status_cancelled'); |
625 case Download.States.REMOVED: | |
626 return localStrings.getString('status_removed'); | |
620 case Download.States.PAUSED: | 627 case Download.States.PAUSED: |
621 return localStrings.getString('status_paused'); | 628 return localStrings.getString('status_paused'); |
622 case Download.States.DANGEROUS: | 629 case Download.States.DANGEROUS: |
623 var desc = this.dangerType_ == Download.DangerType.DANGEROUS_FILE ? | 630 var desc = this.dangerType_ == Download.DangerType.DANGEROUS_FILE ? |
624 'danger_file_desc' : 'danger_url_desc'; | 631 'danger_file_desc' : 'danger_url_desc'; |
625 return localStrings.getString(desc); | 632 return localStrings.getString(desc); |
626 case Download.States.INTERRUPTED: | 633 case Download.States.INTERRUPTED: |
627 return localStrings.getString('status_interrupted'); | 634 return localStrings.getString('status_interrupted'); |
628 case Download.States.COMPLETE: | 635 case Download.States.COMPLETE: |
629 return ''; | 636 return ''; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
774 <div id="downloads-summary"> | 781 <div id="downloads-summary"> |
775 <span id="downloads-summary-text" i18n-content="downloads">Downloads</span> | 782 <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> | 783 <a id="clear-all" href="" onclick="clearAll();" i18n-content="clear_all">Cle ar All</a> |
777 </div> | 784 </div> |
778 <div id="downloads-display"></div> | 785 <div id="downloads-display"></div> |
779 </div> | 786 </div> |
780 <div class="footer"> | 787 <div class="footer"> |
781 </div> | 788 </div> |
782 </body> | 789 </body> |
783 </html> | 790 </html> |
OLD | NEW |