Chromium Code Reviews| Index: chrome/browser/download/download_util.cc |
| diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc |
| index 05751ded1ff230e8b028cb2f9f6e1809025a5dfa..98ecfad21f94a32d31099b4704f71b60e7f7b7bf 100644 |
| --- a/chrome/browser/download/download_util.cc |
| +++ b/chrome/browser/download/download_util.cc |
| @@ -664,7 +664,19 @@ DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id) { |
| if (download->safety_state() == DownloadItem::DANGEROUS) { |
| file_value->SetString("state", "DANGEROUS"); |
| } else { |
| - file_value->SetString("state", "COMPLETE"); |
| + bool path_exists = true; |
| +#if defined(OS_WIN) |
| + if (GetFileAttributes( |
| + download->GetTargetFilePath().value().c_str()) == |
| + INVALID_FILE_ATTRIBUTES) |
| + path_exists = false; |
| +#elif defined(OS_POSIX) |
| + if (access(download->GetTargetFilePath().value().c_str(), F_OK) != 0) |
| + path_exists = false; |
| +#else |
| + NOTIMPLEMENTED(); |
| +#endif |
| + file_value->SetString("state", path_exists ? "COMPLETE" : "REMOVED"); |
|
Randy Smith (Not in Mondays)
2011/04/27 18:21:21
All file system accesses need to happen on the FIL
Paweł Hajdan Jr.
2011/04/29 08:43:41
Exactly. And using SetAllow... or re-implementing
|
| } |
| } |