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

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

Issue 22640018: Set up Finch trial for malware download warnings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: string16 to base string 16 Created 7 years, 4 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 * @param {!Element} node The target element to show or hide. 9 * @param {!Element} node The target element to show or hide.
10 * @param {boolean} isShow Should the target element be visible. 10 * @param {boolean} isShow Should the target element be visible.
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 */ 416 */
417 Download.prototype.update = function(download) { 417 Download.prototype.update = function(download) {
418 this.id_ = download.id; 418 this.id_ = download.id;
419 this.filePath_ = download.file_path; 419 this.filePath_ = download.file_path;
420 this.fileUrl_ = download.file_url; 420 this.fileUrl_ = download.file_url;
421 this.fileName_ = download.file_name; 421 this.fileName_ = download.file_name;
422 this.url_ = download.url; 422 this.url_ = download.url;
423 this.state_ = download.state; 423 this.state_ = download.state;
424 this.fileExternallyRemoved_ = download.file_externally_removed; 424 this.fileExternallyRemoved_ = download.file_externally_removed;
425 this.dangerType_ = download.danger_type; 425 this.dangerType_ = download.danger_type;
426 this.finchString_ = download.finch_string;
426 this.lastReasonDescription_ = download.last_reason_text; 427 this.lastReasonDescription_ = download.last_reason_text;
427 this.byExtensionId_ = download.by_ext_id; 428 this.byExtensionId_ = download.by_ext_id;
428 this.byExtensionName_ = download.by_ext_name; 429 this.byExtensionName_ = download.by_ext_name;
429 430
430 this.since_ = download.since_string; 431 this.since_ = download.since_string;
431 this.date_ = download.date_string; 432 this.date_ = download.date_string;
432 433
433 // See DownloadItem::PercentComplete 434 // See DownloadItem::PercentComplete
434 this.percent_ = Math.max(download.percent, 0); 435 this.percent_ = Math.max(download.percent, 0);
435 this.progressStatusText_ = download.progress_status_text; 436 this.progressStatusText_ = download.progress_status_text;
436 this.received_ = download.received; 437 this.received_ = download.received;
437 438
438 if (this.state_ == Download.States.DANGEROUS) { 439 if (this.state_ == Download.States.DANGEROUS) {
439 if (this.dangerType_ == Download.DangerType.DANGEROUS_FILE) { 440 if (this.dangerType_ == Download.DangerType.DANGEROUS_FILE) {
440 this.dangerDesc_.textContent = loadTimeData.getStringF('danger_file_desc', 441 this.dangerDesc_.textContent = loadTimeData.getStringF('danger_file_desc',
441 this.fileName_); 442 this.fileName_);
442 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_URL) { 443 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_URL) {
443 this.dangerDesc_.textContent = loadTimeData.getString('danger_url_desc'); 444 this.dangerDesc_.textContent = loadTimeData.getString('danger_url_desc');
444 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_CONTENT || 445 } else if (this.dangerType_ == Download.DangerType.DANGEROUS_CONTENT ||
445 this.dangerType_ == Download.DangerType.DANGEROUS_HOST) { 446 this.dangerType_ == Download.DangerType.DANGEROUS_HOST) {
446 this.dangerDesc_.textContent = loadTimeData.getStringF( 447 this.dangerDesc_.textContent = loadTimeData.getStringF(
447 'danger_content_desc', this.fileName_); 448 'danger_content_desc', this.fileName_);
448 } else if (this.dangerType_ == Download.DangerType.UNCOMMON_CONTENT) { 449 } else if (this.dangerType_ == Download.DangerType.UNCOMMON_CONTENT) {
449 this.dangerDesc_.textContent = loadTimeData.getStringF( 450 this.dangerDesc_.textContent = loadTimeData.getStringF(
450 'danger_uncommon_desc', this.fileName_); 451 'danger_uncommon_desc', this.fileName_);
451 } else if (this.dangerType_ == Download.DangerType.POTENTIALLY_UNWANTED) { 452 } else if (this.dangerType_ == Download.DangerType.POTENTIALLY_UNWANTED) {
452 this.dangerDesc_.textContent = loadTimeData.getStringF( 453 this.dangerDesc_.textContent = loadTimeData.getStringF(
453 'danger_potentially_unwanted_desc', this.fileName_); 454 'danger_potentially_unwanted_desc', this.fileName_);
454 } 455 }
456 if (this.finchString_) {
457 // Finch trial overrides the normal display string.
458 this.dangerDesc_.textContent = this.finchString_;
459 }
455 this.danger_.style.display = 'block'; 460 this.danger_.style.display = 'block';
456 this.safe_.style.display = 'none'; 461 this.safe_.style.display = 'none';
457 } else { 462 } else {
458 downloads.scheduleIconLoad(this.nodeImg_, 463 downloads.scheduleIconLoad(this.nodeImg_,
459 'chrome://fileicon/' + 464 'chrome://fileicon/' +
460 encodeURIComponent(this.filePath_) + 465 encodeURIComponent(this.filePath_) +
461 '?scale=' + window.devicePixelRatio + 'x'); 466 '?scale=' + window.devicePixelRatio + 'x');
462 467
463 if (this.state_ == Download.States.COMPLETE && 468 if (this.state_ == Download.States.COMPLETE &&
464 !this.fileExternallyRemoved_) { 469 !this.fileExternallyRemoved_) {
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 if (Date.now() - start > 50) { 815 if (Date.now() - start > 50) {
811 clearTimeout(resultsTimeout); 816 clearTimeout(resultsTimeout);
812 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5); 817 resultsTimeout = setTimeout(tryDownloadUpdatedPeriodically, 5);
813 break; 818 break;
814 } 819 }
815 } 820 }
816 } 821 }
817 822
818 // Add handlers to HTML elements. 823 // Add handlers to HTML elements.
819 window.addEventListener('DOMContentLoaded', load); 824 window.addEventListener('DOMContentLoaded', load);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698