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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 }; | 359 }; |
360 | 360 |
361 /** | 361 /** |
362 * Explains why a download is in DANGEROUS state. | 362 * Explains why a download is in DANGEROUS state. |
363 */ | 363 */ |
364 Download.DangerType = { | 364 Download.DangerType = { |
365 NOT_DANGEROUS: 'NOT_DANGEROUS', | 365 NOT_DANGEROUS: 'NOT_DANGEROUS', |
366 DANGEROUS_FILE: 'DANGEROUS_FILE', | 366 DANGEROUS_FILE: 'DANGEROUS_FILE', |
367 DANGEROUS_URL: 'DANGEROUS_URL', | 367 DANGEROUS_URL: 'DANGEROUS_URL', |
368 DANGEROUS_CONTENT: 'DANGEROUS_CONTENT', | 368 DANGEROUS_CONTENT: 'DANGEROUS_CONTENT', |
369 UNCOMMON_CONTENT: 'UNCOMMON_CONTENT' | 369 UNCOMMON_CONTENT: 'UNCOMMON_CONTENT' |
benjhayden
2013/01/31 15:46:37
Need a comma at the end of this line.
mattm
2013/01/31 21:45:58
Done.
| |
370 DANGEROUS_HOST: 'DANGEROUS_HOST' | |
370 }; | 371 }; |
371 | 372 |
372 /** | 373 /** |
373 * Constants for the progress meter. | 374 * Constants for the progress meter. |
374 */ | 375 */ |
375 | 376 |
376 Download.Progress = (function() { | 377 Download.Progress = (function() { |
377 var scale = window.devicePixelRatio; | 378 var scale = window.devicePixelRatio; |
378 return { | 379 return { |
379 width: 48 * scale, | 380 width: 48 * scale, |
(...skipping 28 matching lines...) Expand all Loading... | |
408 this.percent_ = Math.max(download.percent, 0); | 409 this.percent_ = Math.max(download.percent, 0); |
409 this.progressStatusText_ = download.progress_status_text; | 410 this.progressStatusText_ = download.progress_status_text; |
410 this.received_ = download.received; | 411 this.received_ = download.received; |
411 | 412 |
412 if (this.state_ == Download.States.DANGEROUS) { | 413 if (this.state_ == Download.States.DANGEROUS) { |
413 if (this.dangerType_ == Download.DangerType.DANGEROUS_FILE) { | 414 if (this.dangerType_ == Download.DangerType.DANGEROUS_FILE) { |
414 this.dangerDesc_.textContent = loadTimeData.getStringF('danger_file_desc', | 415 this.dangerDesc_.textContent = loadTimeData.getStringF('danger_file_desc', |
415 this.fileName_); | 416 this.fileName_); |
416 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_URL) { | 417 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_URL) { |
417 this.dangerDesc_.textContent = loadTimeData.getString('danger_url_desc'); | 418 this.dangerDesc_.textContent = loadTimeData.getString('danger_url_desc'); |
418 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_CONTENT) { | 419 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_CONTENT || |
420 this.dangerType_ == Download.DangerType.DANGEROUS_HOST) { | |
419 this.dangerDesc_.textContent = loadTimeData.getStringF( | 421 this.dangerDesc_.textContent = loadTimeData.getStringF( |
420 'danger_content_desc', this.fileName_); | 422 'danger_content_desc', this.fileName_); |
421 } else if (this.dangerType_ == Download.DangerType.UNCOMMON_CONTENT) { | 423 } else if (this.dangerType_ == Download.DangerType.UNCOMMON_CONTENT) { |
422 this.dangerDesc_.textContent = loadTimeData.getStringF( | 424 this.dangerDesc_.textContent = loadTimeData.getStringF( |
423 'danger_uncommon_desc', this.fileName_); | 425 'danger_uncommon_desc', this.fileName_); |
424 } | 426 } |
425 this.danger_.style.display = 'block'; | 427 this.danger_.style.display = 'block'; |
426 this.safe_.style.display = 'none'; | 428 this.safe_.style.display = 'none'; |
427 } else { | 429 } else { |
428 downloads.scheduleIconLoad(this.nodeImg_, | 430 downloads.scheduleIconLoad(this.nodeImg_, |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
748 if (Date.now() - start > 50) { | 750 if (Date.now() - start > 50) { |
749 clearTimeout(resultsTimeout); | 751 clearTimeout(resultsTimeout); |
750 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); | 752 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); |
751 break; | 753 break; |
752 } | 754 } |
753 } | 755 } |
754 } | 756 } |
755 | 757 |
756 // Add handlers to HTML elements. | 758 // Add handlers to HTML elements. |
757 window.addEventListener('DOMContentLoaded', load); | 759 window.addEventListener('DOMContentLoaded', load); |
OLD | NEW |