Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: chrome/browser/resources/downloads/item.js

Issue 977473002: downloads: break downloads.js into more classes/files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: thestig@ review Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/downloads/focus_row.js ('k') | chrome/browser/resources/downloads/item_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698