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

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

Issue 8558029: Update download page to deal with new DANGEROUS_CONTENT state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 /////////////////////////////////////////////////////////////////////////////// 5 ///////////////////////////////////////////////////////////////////////////////
6 // Helper functions 6 // Helper functions
7 function $(o) {return document.getElementById(o);} 7 function $(o) {return document.getElementById(o);}
8 8
9 /** 9 /**
10 * Sets the display style of a node. 10 * Sets the display style of a node.
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 INTERRUPTED : "INTERRUPTED", 298 INTERRUPTED : "INTERRUPTED",
299 } 299 }
300 300
301 /** 301 /**
302 * Explains why a download is in DANGEROUS state. 302 * Explains why a download is in DANGEROUS state.
303 */ 303 */
304 Download.DangerType = { 304 Download.DangerType = {
305 NOT_DANGEROUS: "NOT_DANGEROUS", 305 NOT_DANGEROUS: "NOT_DANGEROUS",
306 DANGEROUS_FILE: "DANGEROUS_FILE", 306 DANGEROUS_FILE: "DANGEROUS_FILE",
307 DANGEROUS_URL: "DANGEROUS_URL", 307 DANGEROUS_URL: "DANGEROUS_URL",
308 DANGEROUS_CONTENT: "DANGEROUS_CONTENT"
308 } 309 }
309 310
310 /** 311 /**
311 * Constants for the progress meter. 312 * Constants for the progress meter.
312 */ 313 */
313 Download.Progress = { 314 Download.Progress = {
314 width : 48, 315 width : 48,
315 height : 48, 316 height : 48,
316 radius : 24, 317 radius : 24,
317 centerX : 24, 318 centerX : 24,
(...skipping 22 matching lines...) Expand all
340 // See DownloadItem::PercentComplete 341 // See DownloadItem::PercentComplete
341 this.percent_ = Math.max(download.percent, 0); 342 this.percent_ = Math.max(download.percent, 0);
342 this.progressStatusText_ = download.progress_status_text; 343 this.progressStatusText_ = download.progress_status_text;
343 this.received_ = download.received; 344 this.received_ = download.received;
344 345
345 if (this.state_ == Download.States.DANGEROUS) { 346 if (this.state_ == Download.States.DANGEROUS) {
346 if (this.dangerType_ == Download.DangerType.DANGEROUS_FILE) { 347 if (this.dangerType_ == Download.DangerType.DANGEROUS_FILE) {
347 this.dangerDesc_.textContent = localStrings.getStringF('danger_file_desc', 348 this.dangerDesc_.textContent = localStrings.getStringF('danger_file_desc',
348 this.fileName_); 349 this.fileName_);
349 } else { 350 } else {
351 // This is used by both DANGEROUS_URL and DANGEROUS_CONTENT.
350 this.dangerDesc_.textContent = localStrings.getString('danger_url_desc'); 352 this.dangerDesc_.textContent = localStrings.getString('danger_url_desc');
351 } 353 }
352 this.danger_.style.display = 'block'; 354 this.danger_.style.display = 'block';
353 this.safe_.style.display = 'none'; 355 this.safe_.style.display = 'none';
354 } else { 356 } else {
355 this.nodeImg_.src = 'chrome://fileicon/' + this.filePath_; 357 this.nodeImg_.src = 'chrome://fileicon/' + this.filePath_;
356 358
357 if (this.state_ == Download.States.COMPLETE && 359 if (this.state_ == Download.States.COMPLETE &&
358 !this.fileExternallyRemoved_) { 360 !this.fileExternallyRemoved_) {
359 this.nodeFileLink_.textContent = this.fileName_; 361 this.nodeFileLink_.textContent = this.fileName_;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 */ 457 */
456 Download.prototype.getStatusText_ = function() { 458 Download.prototype.getStatusText_ = function() {
457 switch (this.state_) { 459 switch (this.state_) {
458 case Download.States.IN_PROGRESS: 460 case Download.States.IN_PROGRESS:
459 return this.progressStatusText_; 461 return this.progressStatusText_;
460 case Download.States.CANCELLED: 462 case Download.States.CANCELLED:
461 return localStrings.getString('status_cancelled'); 463 return localStrings.getString('status_cancelled');
462 case Download.States.PAUSED: 464 case Download.States.PAUSED:
463 return localStrings.getString('status_paused'); 465 return localStrings.getString('status_paused');
464 case Download.States.DANGEROUS: 466 case Download.States.DANGEROUS:
467 // danger_url_desc is also used by DANGEROUS_CONTENT
achuithb 2011/11/21 21:34:36 nit: period at the end of comment?
asanka 2011/11/21 22:46:58 Done.
465 var desc = this.dangerType_ == Download.DangerType.DANGEROUS_FILE ? 468 var desc = this.dangerType_ == Download.DangerType.DANGEROUS_FILE ?
466 'danger_file_desc' : 'danger_url_desc'; 469 'danger_file_desc' : 'danger_url_desc';
467 return localStrings.getString(desc); 470 return localStrings.getString(desc);
468 case Download.States.INTERRUPTED: 471 case Download.States.INTERRUPTED:
469 return localStrings.getString('status_interrupted'); 472 return localStrings.getString('status_interrupted');
470 case Download.States.COMPLETE: 473 case Download.States.COMPLETE:
471 return this.fileExternallyRemoved_ ? 474 return this.fileExternallyRemoved_ ?
472 localStrings.getString('status_removed') : ''; 475 localStrings.getString('status_removed') : '';
473 } 476 }
474 } 477 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 openDownloadsFolderLink.oncontextmenu = function() { return false; }; 640 openDownloadsFolderLink.oncontextmenu = function() { return false; };
638 641
639 $('search-link').onclick = function () { 642 $('search-link').onclick = function () {
640 setSearch(''); 643 setSearch('');
641 return false; 644 return false;
642 }; 645 };
643 $('search-form').onsubmit = function () { 646 $('search-form').onsubmit = function () {
644 setSearch(this.term.value); 647 setSearch(this.term.value);
645 return false; 648 return false;
646 }; 649 };
OLDNEW
« chrome/browser/download/download_util.cc ('K') | « chrome/browser/resources/active_downloads.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698