OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/download/download_util.h" | 7 #include "chrome/browser/download/download_util.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <shobjidl.h> | 10 #include <shobjidl.h> |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 file_value->SetString("progress_status_text", | 694 file_value->SetString("progress_status_text", |
695 GetProgressStatusText(download)); | 695 GetProgressStatusText(download)); |
696 | 696 |
697 file_value->SetInteger("percent", | 697 file_value->SetInteger("percent", |
698 static_cast<int>(download->PercentComplete())); | 698 static_cast<int>(download->PercentComplete())); |
699 file_value->SetInteger("received", | 699 file_value->SetInteger("received", |
700 static_cast<int>(download->received_bytes())); | 700 static_cast<int>(download->received_bytes())); |
701 } else if (download->IsCancelled()) { | 701 } else if (download->IsCancelled()) { |
702 file_value->SetString("state", "CANCELLED"); | 702 file_value->SetString("state", "CANCELLED"); |
703 } else if (download->IsComplete()) { | 703 } else if (download->IsComplete()) { |
704 if (download->safety_state() == DownloadItem::DANGEROUS) { | 704 if (download->file_externally_removed()) { |
| 705 file_value->SetString("state", "REMOVED"); |
| 706 } else if (download->safety_state() == DownloadItem::DANGEROUS) { |
705 file_value->SetString("state", "DANGEROUS"); | 707 file_value->SetString("state", "DANGEROUS"); |
706 } else { | 708 } else { |
707 file_value->SetString("state", "COMPLETE"); | 709 file_value->SetString("state", "COMPLETE"); |
708 } | 710 } |
709 } else if (download->state() == DownloadItem::REMOVING) { | 711 } else if (download->state() == DownloadItem::REMOVING) { |
710 file_value->SetString("state", "REMOVING"); | 712 file_value->SetString("state", "REMOVING"); |
711 } else { | 713 } else { |
712 NOTREACHED() << "state undefined"; | 714 NOTREACHED() << "state undefined"; |
713 } | 715 } |
714 | 716 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 FilePath GetCrDownloadPath(const FilePath& suggested_path) { | 925 FilePath GetCrDownloadPath(const FilePath& suggested_path) { |
924 FilePath::StringType file_name; | 926 FilePath::StringType file_name; |
925 base::SStringPrintf( | 927 base::SStringPrintf( |
926 &file_name, | 928 &file_name, |
927 PRFilePathLiteral FILE_PATH_LITERAL(".crdownload"), | 929 PRFilePathLiteral FILE_PATH_LITERAL(".crdownload"), |
928 suggested_path.value().c_str()); | 930 suggested_path.value().c_str()); |
929 return FilePath(file_name); | 931 return FilePath(file_name); |
930 } | 932 } |
931 | 933 |
932 } // namespace download_util | 934 } // namespace download_util |
OLD | NEW |