| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /////////////////////////////////////////////////////////////////////////////// | 5 /////////////////////////////////////////////////////////////////////////////// |
| 6 // Helper functions | 6 // Helper functions |
| 7 function $(o) {return document.getElementById(o);} | 7 function $(o) {return document.getElementById(o);} |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Sets the display style of a node. | 10 * Sets the display style of a node. |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 // See DownloadItem::PercentComplete | 341 // See DownloadItem::PercentComplete |
| 342 this.percent_ = Math.max(download.percent, 0); | 342 this.percent_ = Math.max(download.percent, 0); |
| 343 this.progressStatusText_ = download.progress_status_text; | 343 this.progressStatusText_ = download.progress_status_text; |
| 344 this.received_ = download.received; | 344 this.received_ = download.received; |
| 345 | 345 |
| 346 if (this.state_ == Download.States.DANGEROUS) { | 346 if (this.state_ == Download.States.DANGEROUS) { |
| 347 if (this.dangerType_ == Download.DangerType.DANGEROUS_FILE) { | 347 if (this.dangerType_ == Download.DangerType.DANGEROUS_FILE) { |
| 348 this.dangerDesc_.textContent = localStrings.getStringF('danger_file_desc', | 348 this.dangerDesc_.textContent = localStrings.getStringF('danger_file_desc', |
| 349 this.fileName_); | 349 this.fileName_); |
| 350 } else { | 350 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_URL) { |
| 351 // This is used by both DANGEROUS_URL and DANGEROUS_CONTENT. | |
| 352 this.dangerDesc_.textContent = localStrings.getString('danger_url_desc'); | 351 this.dangerDesc_.textContent = localStrings.getString('danger_url_desc'); |
| 352 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_CONTENT) { |
| 353 this.dangerDesc_.textContent = localStrings.getStringF( |
| 354 'danger_content_desc', this.fileName_); |
| 353 } | 355 } |
| 354 this.danger_.style.display = 'block'; | 356 this.danger_.style.display = 'block'; |
| 355 this.safe_.style.display = 'none'; | 357 this.safe_.style.display = 'none'; |
| 356 } else { | 358 } else { |
| 357 this.nodeImg_.src = 'chrome://fileicon/' + this.filePath_; | 359 this.nodeImg_.src = 'chrome://fileicon/' + this.filePath_; |
| 358 | 360 |
| 359 if (this.state_ == Download.States.COMPLETE && | 361 if (this.state_ == Download.States.COMPLETE && |
| 360 !this.fileExternallyRemoved_) { | 362 !this.fileExternallyRemoved_) { |
| 361 this.nodeFileLink_.textContent = this.fileName_; | 363 this.nodeFileLink_.textContent = this.fileName_; |
| 362 this.nodeFileLink_.href = this.fileUrl_; | 364 this.nodeFileLink_.href = this.fileUrl_; |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 openDownloadsFolderLink.oncontextmenu = function() { return false; }; | 642 openDownloadsFolderLink.oncontextmenu = function() { return false; }; |
| 641 | 643 |
| 642 $('search-link').onclick = function () { | 644 $('search-link').onclick = function () { |
| 643 setSearch(''); | 645 setSearch(''); |
| 644 return false; | 646 return false; |
| 645 }; | 647 }; |
| 646 $('search-form').onsubmit = function () { | 648 $('search-form').onsubmit = function () { |
| 647 setSearch(this.term.value); | 649 setSearch(this.term.value); |
| 648 return false; | 650 return false; |
| 649 }; | 651 }; |
| OLD | NEW |