| 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 // Download utility implementation | 5 // Download utility implementation |
| 6 | 6 |
| 7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
| 8 | 8 |
| 9 #include "chrome/browser/download/download_util.h" | 9 #include "chrome/browser/download/download_util.h" |
| 10 | 10 |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 file_value->SetString("last_reason_text", | 507 file_value->SetString("last_reason_text", |
| 508 BaseDownloadItemModel::InterruptReasonMessage( | 508 BaseDownloadItemModel::InterruptReasonMessage( |
| 509 download->GetLastReason())); | 509 download->GetLastReason())); |
| 510 } else if (download->IsCancelled()) { | 510 } else if (download->IsCancelled()) { |
| 511 file_value->SetString("state", "CANCELLED"); | 511 file_value->SetString("state", "CANCELLED"); |
| 512 } else if (download->IsComplete()) { | 512 } else if (download->IsComplete()) { |
| 513 if (download->GetSafetyState() == DownloadItem::DANGEROUS) | 513 if (download->GetSafetyState() == DownloadItem::DANGEROUS) |
| 514 file_value->SetString("state", "DANGEROUS"); | 514 file_value->SetString("state", "DANGEROUS"); |
| 515 else | 515 else |
| 516 file_value->SetString("state", "COMPLETE"); | 516 file_value->SetString("state", "COMPLETE"); |
| 517 } else if (download->GetState() == DownloadItem::REMOVING) { | |
| 518 file_value->SetString("state", "REMOVING"); | |
| 519 } else { | 517 } else { |
| 520 NOTREACHED() << "state undefined"; | 518 NOTREACHED() << "state undefined"; |
| 521 } | 519 } |
| 522 | 520 |
| 523 return file_value; | 521 return file_value; |
| 524 } | 522 } |
| 525 | 523 |
| 526 string16 GetProgressStatusText(DownloadItem* download) { | 524 string16 GetProgressStatusText(DownloadItem* download) { |
| 527 int64 total = download->GetTotalBytes(); | 525 int64 total = download->GetTotalBytes(); |
| 528 int64 size = download->GetReceivedBytes(); | 526 int64 size = download->GetReceivedBytes(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 UMA_HISTOGRAM_ENUMERATION( | 650 UMA_HISTOGRAM_ENUMERATION( |
| 653 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); | 651 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); |
| 654 } | 652 } |
| 655 | 653 |
| 656 void RecordDownloadSource(ChromeDownloadSource source) { | 654 void RecordDownloadSource(ChromeDownloadSource source) { |
| 657 UMA_HISTOGRAM_ENUMERATION( | 655 UMA_HISTOGRAM_ENUMERATION( |
| 658 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); | 656 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); |
| 659 } | 657 } |
| 660 | 658 |
| 661 } // namespace download_util | 659 } // namespace download_util |
| OLD | NEW |