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