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

Side by Side Diff: chrome/browser/download/download_item_model.cc

Issue 26938003: Don't prompt to save malicious downloads on exit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed to only target Malicious (not Maybe-Malicious or Dangerous) files Created 7 years, 2 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 #include "chrome/browser/download/download_item_model.h" 5 #include "chrome/browser/download/download_item_model.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 // We shouldn't get any of these due to the IsDangerous() test above. 440 // We shouldn't get any of these due to the IsDangerous() test above.
441 NOTREACHED(); 441 NOTREACHED();
442 // Fallthrough. 442 // Fallthrough.
443 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE: 443 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE:
444 return false; 444 return false;
445 } 445 }
446 NOTREACHED(); 446 NOTREACHED();
447 return false; 447 return false;
448 } 448 }
449 449
450 // If you change this definition of malicious, also update
451 // DownloadManagerImpl::NonMaliciousInProgressCount.
450 bool DownloadItemModel::IsMalicious() const { 452 bool DownloadItemModel::IsMalicious() const {
451 if (!MightBeMalicious()) 453 if (!MightBeMalicious())
452 return false; 454 return false;
453 switch (download_->GetDangerType()) { 455 switch (download_->GetDangerType()) {
454 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: 456 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL:
455 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: 457 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT:
456 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: 458 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST:
457 return true; 459 return true;
458 460
459 case content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: 461 case content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS:
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 608 }
607 609
608 // In progress download with no known time left and non-zero completed bytes: 610 // In progress download with no known time left and non-zero completed bytes:
609 // "100/120 MB" or "100 MB" 611 // "100/120 MB" or "100 MB"
610 if (GetCompletedBytes() > 0) 612 if (GetCompletedBytes() > 0)
611 return size_ratio; 613 return size_ratio;
612 614
613 // Instead of displaying "0 B" we say "Starting..." 615 // Instead of displaying "0 B" we say "Starting..."
614 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING); 616 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING);
615 } 617 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698