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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 file_value->SetString("last_reason_text", | 499 file_value->SetString("last_reason_text", |
500 BaseDownloadItemModel::InterruptReasonMessage( | 500 BaseDownloadItemModel::InterruptReasonMessage( |
501 download->GetLastReason())); | 501 download->GetLastReason())); |
502 } else if (download->IsCancelled()) { | 502 } else if (download->IsCancelled()) { |
503 file_value->SetString("state", "CANCELLED"); | 503 file_value->SetString("state", "CANCELLED"); |
504 } else if (download->IsComplete()) { | 504 } else if (download->IsComplete()) { |
505 if (download->GetSafetyState() == DownloadItem::DANGEROUS) | 505 if (download->GetSafetyState() == DownloadItem::DANGEROUS) |
506 file_value->SetString("state", "DANGEROUS"); | 506 file_value->SetString("state", "DANGEROUS"); |
507 else | 507 else |
508 file_value->SetString("state", "COMPLETE"); | 508 file_value->SetString("state", "COMPLETE"); |
| 509 } else if (download->GetState() == DownloadItem::REMOVING) { |
| 510 file_value->SetString("state", "REMOVING"); |
509 } else { | 511 } else { |
510 NOTREACHED() << "state undefined"; | 512 NOTREACHED() << "state undefined"; |
511 } | 513 } |
512 | 514 |
513 return file_value; | 515 return file_value; |
514 } | 516 } |
515 | 517 |
516 string16 GetProgressStatusText(DownloadItem* download) { | 518 string16 GetProgressStatusText(DownloadItem* download) { |
517 int64 total = download->GetTotalBytes(); | 519 int64 total = download->GetTotalBytes(); |
518 int64 size = download->GetReceivedBytes(); | 520 int64 size = download->GetReceivedBytes(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 UMA_HISTOGRAM_ENUMERATION( | 639 UMA_HISTOGRAM_ENUMERATION( |
638 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); | 640 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); |
639 } | 641 } |
640 | 642 |
641 void RecordDownloadSource(ChromeDownloadSource source) { | 643 void RecordDownloadSource(ChromeDownloadSource source) { |
642 UMA_HISTOGRAM_ENUMERATION( | 644 UMA_HISTOGRAM_ENUMERATION( |
643 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); | 645 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); |
644 } | 646 } |
645 | 647 |
646 } // namespace download_util | 648 } // namespace download_util |
OLD | NEW |