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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 file_value->SetString("progress_status_text", | 655 file_value->SetString("progress_status_text", |
656 GetProgressStatusText(download)); | 656 GetProgressStatusText(download)); |
657 | 657 |
658 file_value->SetInteger("percent", | 658 file_value->SetInteger("percent", |
659 static_cast<int>(download->PercentComplete())); | 659 static_cast<int>(download->PercentComplete())); |
660 file_value->SetInteger("received", | 660 file_value->SetInteger("received", |
661 static_cast<int>(download->received_bytes())); | 661 static_cast<int>(download->received_bytes())); |
662 } else if (download->IsCancelled()) { | 662 } else if (download->IsCancelled()) { |
663 file_value->SetString("state", "CANCELLED"); | 663 file_value->SetString("state", "CANCELLED"); |
664 } else if (download->IsComplete()) { | 664 } else if (download->IsComplete()) { |
665 if (download->safety_state() == DownloadItem::DANGEROUS) { | 665 if (download->file_externally_removed()) { |
| 666 file_value->SetString("state", "REMOVED"); |
| 667 } else if (download->safety_state() == DownloadItem::DANGEROUS) { |
666 file_value->SetString("state", "DANGEROUS"); | 668 file_value->SetString("state", "DANGEROUS"); |
667 } else { | 669 } else { |
668 file_value->SetString("state", "COMPLETE"); | 670 file_value->SetString("state", "COMPLETE"); |
669 } | 671 } |
670 } | 672 } |
671 | 673 |
672 file_value->SetInteger("total", | 674 file_value->SetInteger("total", |
673 static_cast<int>(download->total_bytes())); | 675 static_cast<int>(download->total_bytes())); |
674 | 676 |
675 return file_value; | 677 return file_value; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 // Extensions that are not from the gallery are considered dangerous. | 903 // Extensions that are not from the gallery are considered dangerous. |
902 ExtensionService* service = profile->GetExtensionService(); | 904 ExtensionService* service = profile->GetExtensionService(); |
903 if (!service || | 905 if (!service || |
904 !service->IsDownloadFromGallery(info->url(), info->referrer_url)) | 906 !service->IsDownloadFromGallery(info->url(), info->referrer_url)) |
905 return true; | 907 return true; |
906 } | 908 } |
907 return false; | 909 return false; |
908 } | 910 } |
909 | 911 |
910 } // namespace download_util | 912 } // namespace download_util |
OLD | NEW |