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

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

Issue 9621007: Add new danger type for uncommon or unknown downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 8 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 | Annotate | Revision Log
OLDNEW
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 * Sets the display style of a node. 8 * Sets the display style of a node.
9 */ 9 */
10 function showInline(node, isShow) { 10 function showInline(node, isShow) {
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 INTERRUPTED: 'INTERRUPTED', 332 INTERRUPTED: 'INTERRUPTED',
333 }; 333 };
334 334
335 /** 335 /**
336 * Explains why a download is in DANGEROUS state. 336 * Explains why a download is in DANGEROUS state.
337 */ 337 */
338 Download.DangerType = { 338 Download.DangerType = {
339 NOT_DANGEROUS: 'NOT_DANGEROUS', 339 NOT_DANGEROUS: 'NOT_DANGEROUS',
340 DANGEROUS_FILE: 'DANGEROUS_FILE', 340 DANGEROUS_FILE: 'DANGEROUS_FILE',
341 DANGEROUS_URL: 'DANGEROUS_URL', 341 DANGEROUS_URL: 'DANGEROUS_URL',
342 DANGEROUS_CONTENT: 'DANGEROUS_CONTENT' 342 DANGEROUS_CONTENT: 'DANGEROUS_CONTENT',
343 }; 343 UNCOMMON_CONTENT: 'UNCOMMON_CONTENT'
344 }
344 345
345 /** 346 /**
346 * Constants for the progress meter. 347 * Constants for the progress meter.
347 */ 348 */
348 Download.Progress = { 349 Download.Progress = {
349 width: 48, 350 width: 48,
350 height: 48, 351 height: 48,
351 radius: 24, 352 radius: 24,
352 centerX: 24, 353 centerX: 24,
353 centerY: 24, 354 centerY: 24,
(...skipping 25 matching lines...) Expand all
379 380
380 if (this.state_ == Download.States.DANGEROUS) { 381 if (this.state_ == Download.States.DANGEROUS) {
381 if (this.dangerType_ == Download.DangerType.DANGEROUS_FILE) { 382 if (this.dangerType_ == Download.DangerType.DANGEROUS_FILE) {
382 this.dangerDesc_.textContent = localStrings.getStringF('danger_file_desc', 383 this.dangerDesc_.textContent = localStrings.getStringF('danger_file_desc',
383 this.fileName_); 384 this.fileName_);
384 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_URL) { 385 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_URL) {
385 this.dangerDesc_.textContent = localStrings.getString('danger_url_desc'); 386 this.dangerDesc_.textContent = localStrings.getString('danger_url_desc');
386 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_CONTENT) { 387 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_CONTENT) {
387 this.dangerDesc_.textContent = localStrings.getStringF( 388 this.dangerDesc_.textContent = localStrings.getStringF(
388 'danger_content_desc', this.fileName_); 389 'danger_content_desc', this.fileName_);
390 } else if (this.dangerType_ == Download.DangerType.UNCOMMON_CONTENT) {
391 this.dangerDesc_.textContent = localStrings.getStringF(
392 'danger_uncommon_desc', this.fileName_);
389 } 393 }
390 this.danger_.style.display = 'block'; 394 this.danger_.style.display = 'block';
391 this.safe_.style.display = 'none'; 395 this.safe_.style.display = 'none';
392 } else { 396 } else {
393 downloads.scheduleIconLoad(this.nodeImg_, 397 downloads.scheduleIconLoad(this.nodeImg_,
394 'chrome://fileicon/' + 398 'chrome://fileicon/' +
395 encodeURIComponent(this.filePath_)); 399 encodeURIComponent(this.filePath_));
396 400
397 if (this.state_ == Download.States.COMPLETE && 401 if (this.state_ == Download.States.COMPLETE &&
398 !this.fileExternallyRemoved_) { 402 !this.fileExternallyRemoved_) {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 if (Date.now() - start > 50) { 695 if (Date.now() - start > 50) {
692 clearTimeout(resultsTimeout); 696 clearTimeout(resultsTimeout);
693 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); 697 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5);
694 break; 698 break;
695 } 699 }
696 } 700 }
697 } 701 }
698 702
699 // Add handlers to HTML elements. 703 // Add handlers to HTML elements.
700 window.addEventListener('DOMContentLoaded', load); 704 window.addEventListener('DOMContentLoaded', load);
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/active_downloads.js ('k') | chrome/browser/ui/webui/chromeos/active_downloads_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698