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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 379 |
380 /** | 380 /** |
381 * Explains why a download is in DANGEROUS state. | 381 * Explains why a download is in DANGEROUS state. |
382 */ | 382 */ |
383 Download.DangerType = { | 383 Download.DangerType = { |
384 NOT_DANGEROUS: 'NOT_DANGEROUS', | 384 NOT_DANGEROUS: 'NOT_DANGEROUS', |
385 DANGEROUS_FILE: 'DANGEROUS_FILE', | 385 DANGEROUS_FILE: 'DANGEROUS_FILE', |
386 DANGEROUS_URL: 'DANGEROUS_URL', | 386 DANGEROUS_URL: 'DANGEROUS_URL', |
387 DANGEROUS_CONTENT: 'DANGEROUS_CONTENT', | 387 DANGEROUS_CONTENT: 'DANGEROUS_CONTENT', |
388 UNCOMMON_CONTENT: 'UNCOMMON_CONTENT', | 388 UNCOMMON_CONTENT: 'UNCOMMON_CONTENT', |
389 DANGEROUS_HOST: 'DANGEROUS_HOST' | 389 DANGEROUS_HOST: 'DANGEROUS_HOST', |
| 390 POTENTIALLY_UNWANTED: 'POTENTIALLY_UNWANTED', |
390 }; | 391 }; |
391 | 392 |
392 /** | 393 /** |
393 * Constants for the progress meter. | 394 * Constants for the progress meter. |
394 */ | 395 */ |
395 | 396 |
396 Download.Progress = (function() { | 397 Download.Progress = (function() { |
397 var scale = window.devicePixelRatio; | 398 var scale = window.devicePixelRatio; |
398 return { | 399 return { |
399 width: 48 * scale, | 400 width: 48 * scale, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 this.fileName_); | 436 this.fileName_); |
436 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_URL) { | 437 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_URL) { |
437 this.dangerDesc_.textContent = loadTimeData.getString('danger_url_desc'); | 438 this.dangerDesc_.textContent = loadTimeData.getString('danger_url_desc'); |
438 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_CONTENT || | 439 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_CONTENT || |
439 this.dangerType_ == Download.DangerType.DANGEROUS_HOST) { | 440 this.dangerType_ == Download.DangerType.DANGEROUS_HOST) { |
440 this.dangerDesc_.textContent = loadTimeData.getStringF( | 441 this.dangerDesc_.textContent = loadTimeData.getStringF( |
441 'danger_content_desc', this.fileName_); | 442 'danger_content_desc', this.fileName_); |
442 } else if (this.dangerType_ == Download.DangerType.UNCOMMON_CONTENT) { | 443 } else if (this.dangerType_ == Download.DangerType.UNCOMMON_CONTENT) { |
443 this.dangerDesc_.textContent = loadTimeData.getStringF( | 444 this.dangerDesc_.textContent = loadTimeData.getStringF( |
444 'danger_uncommon_desc', this.fileName_); | 445 'danger_uncommon_desc', this.fileName_); |
| 446 } else if (this.dangerType_ == Download.DangerType.POTENTIALLY_UNWANTED) { |
| 447 this.dangerDesc_.textContent = loadTimeData.getStringF( |
| 448 'danger_potentially_unwanted_desc', this.fileName_); |
445 } | 449 } |
446 this.danger_.style.display = 'block'; | 450 this.danger_.style.display = 'block'; |
447 this.safe_.style.display = 'none'; | 451 this.safe_.style.display = 'none'; |
448 } else { | 452 } else { |
449 downloads.scheduleIconLoad(this.nodeImg_, | 453 downloads.scheduleIconLoad(this.nodeImg_, |
450 'chrome://fileicon/' + | 454 'chrome://fileicon/' + |
451 encodeURIComponent(this.filePath_) + | 455 encodeURIComponent(this.filePath_) + |
452 '?scale=' + window.devicePixelRatio + 'x'); | 456 '?scale=' + window.devicePixelRatio + 'x'); |
453 | 457 |
454 if (this.state_ == Download.States.COMPLETE && | 458 if (this.state_ == Download.States.COMPLETE && |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 if (Date.now() - start > 50) { | 788 if (Date.now() - start > 50) { |
785 clearTimeout(resultsTimeout); | 789 clearTimeout(resultsTimeout); |
786 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); | 790 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); |
787 break; | 791 break; |
788 } | 792 } |
789 } | 793 } |
790 } | 794 } |
791 | 795 |
792 // Add handlers to HTML elements. | 796 // Add handlers to HTML elements. |
793 window.addEventListener('DOMContentLoaded', load); | 797 window.addEventListener('DOMContentLoaded', load); |
OLD | NEW |