Re-land: C++ readability review
[chromium-blink-merge.git] / chrome / browser / resources / downloads / item.js
blob348be58a8af28178c5e81299539e6e29dc378d54
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.
5 cr.define('downloads', function() {
6 /** @constructor */
7 function Item() {}
9 /**
10 * The states a download can be in. These correspond to states defined in
11 * DownloadsDOMHandler::CreateDownloadItemValue
12 * @enum {string}
14 Item.States = {
15 IN_PROGRESS: 'IN_PROGRESS',
16 CANCELLED: 'CANCELLED',
17 COMPLETE: 'COMPLETE',
18 PAUSED: 'PAUSED',
19 DANGEROUS: 'DANGEROUS',
20 INTERRUPTED: 'INTERRUPTED',
23 /**
24 * Explains why a download is in DANGEROUS state.
25 * @enum {string}
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',
37 Item.prototype = {
38 /** @type {downloads.ItemView} */
39 view: null,
41 /**
42 * @param {!downloads.Data} data Info about the download.
44 render: function(data) {
45 this.view = this.view || new downloads.ItemView;
46 this.view.update(data);
49 unrender: function() {
50 if (this.view) {
51 this.view.destroy();
52 this.view = null;
57 return {Item: Item};
58 });