OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 cr.define('downloads', function() { |
| 6 /** @constructor */ |
| 7 function Item() {} |
| 8 |
| 9 /** |
| 10 * The states a download can be in. These correspond to states defined in |
| 11 * DownloadsDOMHandler::CreateDownloadItemValue |
| 12 * @enum {string} |
| 13 */ |
| 14 Item.States = { |
| 15 IN_PROGRESS: 'IN_PROGRESS', |
| 16 CANCELLED: 'CANCELLED', |
| 17 COMPLETE: 'COMPLETE', |
| 18 PAUSED: 'PAUSED', |
| 19 DANGEROUS: 'DANGEROUS', |
| 20 INTERRUPTED: 'INTERRUPTED', |
| 21 }; |
| 22 |
| 23 /** |
| 24 * Explains why a download is in DANGEROUS state. |
| 25 * @enum {string} |
| 26 */ |
| 27 Item.DangerType = { |
| 28 NOT_DANGEROUS: 'NOT_DANGEROUS', |
| 29 DANGEROUS_FILE: 'DANGEROUS_FILE', |
| 30 DANGEROUS_URL: 'DANGEROUS_URL', |
| 31 DANGEROUS_CONTENT: 'DANGEROUS_CONTENT', |
| 32 UNCOMMON_CONTENT: 'UNCOMMON_CONTENT', |
| 33 DANGEROUS_HOST: 'DANGEROUS_HOST', |
| 34 POTENTIALLY_UNWANTED: 'POTENTIALLY_UNWANTED', |
| 35 }; |
| 36 |
| 37 Item.prototype = { |
| 38 /** @type {downloads.ItemView} */ |
| 39 view: null, |
| 40 |
| 41 /** |
| 42 * @param {!downloads.Data} data Info about the download. |
| 43 */ |
| 44 render: function(data) { |
| 45 this.view = this.view || new downloads.ItemView; |
| 46 this.view.update(data); |
| 47 }, |
| 48 |
| 49 unrender: function() { |
| 50 if (this.view) { |
| 51 this.view.destroy(); |
| 52 this.view = null; |
| 53 } |
| 54 }, |
| 55 }; |
| 56 |
| 57 return {Item: Item}; |
| 58 }); |
OLD | NEW |