| 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 #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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 // We shouldn't get any of these due to the IsDangerous() test above. | 430 // We shouldn't get any of these due to the IsDangerous() test above. |
| 431 NOTREACHED(); | 431 NOTREACHED(); |
| 432 // Fallthrough. | 432 // Fallthrough. |
| 433 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE: | 433 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE: |
| 434 return false; | 434 return false; |
| 435 } | 435 } |
| 436 NOTREACHED(); | 436 NOTREACHED(); |
| 437 return false; | 437 return false; |
| 438 } | 438 } |
| 439 | 439 |
| 440 // If you change this definition of malicious, also update |
| 441 // DownloadManagerImpl::NonMaliciousInProgressCount. |
| 440 bool DownloadItemModel::IsMalicious() const { | 442 bool DownloadItemModel::IsMalicious() const { |
| 441 if (!MightBeMalicious()) | 443 if (!MightBeMalicious()) |
| 442 return false; | 444 return false; |
| 443 switch (download_->GetDangerType()) { | 445 switch (download_->GetDangerType()) { |
| 444 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: | 446 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: |
| 445 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: | 447 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: |
| 446 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: | 448 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: |
| 447 return true; | 449 return true; |
| 448 | 450 |
| 449 case content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: | 451 case content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 } | 598 } |
| 597 | 599 |
| 598 // In progress download with no known time left and non-zero completed bytes: | 600 // In progress download with no known time left and non-zero completed bytes: |
| 599 // "100/120 MB" or "100 MB" | 601 // "100/120 MB" or "100 MB" |
| 600 if (GetCompletedBytes() > 0) | 602 if (GetCompletedBytes() > 0) |
| 601 return size_ratio; | 603 return size_ratio; |
| 602 | 604 |
| 603 // Instead of displaying "0 B" we say "Starting..." | 605 // Instead of displaying "0 B" we say "Starting..." |
| 604 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING); | 606 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING); |
| 605 } | 607 } |
| OLD | NEW |