Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 /** | |
| 39 * @param {!downloads.Data} data Info about the download. | |
| 40 */ | |
| 41 render: function(data) { | |
| 42 /** @private {!downloads.ItemView} */ | |
| 43 this.view = this.view || new downloads.ItemView; | |
| 44 this.view.update(data); | |
| 45 }, | |
| 46 | |
| 47 unrender: function() { | |
| 48 if (this.view) { | |
| 49 this.view.destroy(); | |
| 50 delete this.view; | |
|
asanka
2015/03/10 04:15:51
seems 'this.view = null' is preferred?
Dan Beam
2015/03/10 05:41:02
eh, i've seen things that talk about delete not be
asanka
2015/03/11 19:57:49
Cool. I'm no expert on this, and I'm okay with eit
| |
| 51 } | |
| 52 }, | |
| 53 }; | |
| 54 | |
| 55 return {Item: Item}; | |
| 56 }); | |
| OLD | NEW |