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 * The type of the download object. The definition is based on | 8 * The type of the download object. The definition is based on |
9 * chrome/browser/ui/webui/downloads_dom_handler.cc:CreateDownloadItemValue() | 9 * chrome/browser/ui/webui/downloads_dom_handler.cc:CreateDownloadItemValue() |
10 * @typedef {{by_ext_id: (string|undefined), | 10 * @typedef {{by_ext_id: (string|undefined), |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 this.nodeProgressForeground_ = | 316 this.nodeProgressForeground_ = |
317 createElementWithClassName('canvas', 'progress'); | 317 createElementWithClassName('canvas', 'progress'); |
318 this.nodeProgressForeground_.width = Download.Progress.width; | 318 this.nodeProgressForeground_.width = Download.Progress.width; |
319 this.nodeProgressForeground_.height = Download.Progress.height; | 319 this.nodeProgressForeground_.height = Download.Progress.height; |
320 this.canvasProgress_ = this.nodeProgressForeground_.getContext('2d'); | 320 this.canvasProgress_ = this.nodeProgressForeground_.getContext('2d'); |
321 | 321 |
322 this.safe_.appendChild(this.nodeProgressForeground_); | 322 this.safe_.appendChild(this.nodeProgressForeground_); |
323 } | 323 } |
324 | 324 |
325 this.nodeImg_ = createElementWithClassName('img', 'icon'); | 325 this.nodeImg_ = createElementWithClassName('img', 'icon'); |
| 326 this.nodeImg_.alt = ''; |
326 this.safe_.appendChild(this.nodeImg_); | 327 this.safe_.appendChild(this.nodeImg_); |
327 | 328 |
328 // FileLink is used for completed downloads, otherwise we show FileName. | 329 // FileLink is used for completed downloads, otherwise we show FileName. |
329 this.nodeTitleArea_ = createElementWithClassName('div', 'title-area'); | 330 this.nodeTitleArea_ = createElementWithClassName('div', 'title-area'); |
330 this.safe_.appendChild(this.nodeTitleArea_); | 331 this.safe_.appendChild(this.nodeTitleArea_); |
331 | 332 |
332 this.nodeFileLink_ = createLink(this.openFile_.bind(this), ''); | 333 this.nodeFileLink_ = createLink(this.openFile_.bind(this), ''); |
333 this.nodeFileLink_.className = 'name'; | 334 this.nodeFileLink_.className = 'name'; |
334 this.nodeFileLink_.style.display = 'none'; | 335 this.nodeFileLink_.style.display = 'none'; |
335 this.nodeTitleArea_.appendChild(this.nodeFileLink_); | 336 this.nodeTitleArea_.appendChild(this.nodeFileLink_); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 this.nodeControls_.appendChild(this.controlCancel_); | 399 this.nodeControls_.appendChild(this.controlCancel_); |
399 | 400 |
400 this.controlByExtension_ = document.createElement('span'); | 401 this.controlByExtension_ = document.createElement('span'); |
401 this.nodeControls_.appendChild(this.controlByExtension_); | 402 this.nodeControls_.appendChild(this.controlByExtension_); |
402 | 403 |
403 // Container for 'unsafe download' UI. | 404 // Container for 'unsafe download' UI. |
404 this.danger_ = createElementWithClassName('div', 'show-dangerous'); | 405 this.danger_ = createElementWithClassName('div', 'show-dangerous'); |
405 this.node.appendChild(this.danger_); | 406 this.node.appendChild(this.danger_); |
406 | 407 |
407 this.dangerNodeImg_ = createElementWithClassName('img', 'icon'); | 408 this.dangerNodeImg_ = createElementWithClassName('img', 'icon'); |
| 409 this.dangerNodeImg_.alt = ''; |
408 this.danger_.appendChild(this.dangerNodeImg_); | 410 this.danger_.appendChild(this.dangerNodeImg_); |
409 | 411 |
410 this.dangerDesc_ = document.createElement('div'); | 412 this.dangerDesc_ = document.createElement('div'); |
411 this.danger_.appendChild(this.dangerDesc_); | 413 this.danger_.appendChild(this.dangerDesc_); |
412 | 414 |
413 // Buttons for the malicious case. | 415 // Buttons for the malicious case. |
414 this.malwareNodeControls_ = createElementWithClassName('div', 'controls'); | 416 this.malwareNodeControls_ = createElementWithClassName('div', 'controls'); |
415 this.malwareSave_ = createLink( | 417 this.malwareSave_ = createLink( |
416 this.saveDangerous_.bind(this), | 418 this.saveDangerous_.bind(this), |
417 loadTimeData.getString('danger_restore')); | 419 loadTimeData.getString('danger_restore')); |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); | 984 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); |
983 break; | 985 break; |
984 } | 986 } |
985 } | 987 } |
986 } | 988 } |
987 | 989 |
988 // Add handlers to HTML elements. | 990 // Add handlers to HTML elements. |
989 window.addEventListener('DOMContentLoaded', load); | 991 window.addEventListener('DOMContentLoaded', load); |
990 | 992 |
991 preventDefaultOnPoundLinkClicks(); // From util.js. | 993 preventDefaultOnPoundLinkClicks(); // From util.js. |
OLD | NEW |